[VBA] Excel-從剪貼簿貼上圖片並縮小

Dim p As Picture
With Selection
    Set p = .Parent.Pictures.Paste
    p.Top = .Top
    p.Left = .Left
    p.ShapeRange.LockAspectRatio = msoTrue  '鎖定長寬比
    p.ShapeRange.Height = Application.CentimetersToPoints(12) '將高度從 12cm 的值轉成 pixel
    'p.ShapeRange.ScaleWidth 0.4, msoTrue '將寬度變成 40%
End With

發表迴響