Excel) (PictureFormat.CropBottom 屬性

傳回或設定從指定圖片或 OLE 物件底部裁剪出來的 點 數。 讀寫 Single。

語法

運算式。CropBottom

運算式 傳回 PictureFormat 物件的運算式。

註解

裁剪尺寸會依據圖片的原始大小來計算。 例如,如果您插入原本高度為 100 點的圖片,請重新縮放為 200 點高,然後將 CropBottom 屬性設為 50,則圖片底部會裁掉 100 點 (不是 50 點的) 。

範例

這個範例會從 myDocument 上第三個圖案的底部裁去 20 點。 為使本範例正常執行,第三個圖案必須是圖片或 OLE 物件。

Set myDocument = Worksheets(1) 
myDocument.Shapes(3).PictureFormat.CropBottom = 20

使用此範例,您可以指定您想要從所選圖形底部裁剪的百分比,而無論圖形是否已縮放。 為使本範例能正常執行,選取的圖案必須是圖片或是 OLE 物件。

percentToCrop = InputBox( _ 
 "What percentage do you want to crop off" & _ 
 " the bottom of this picture?") 
Set shapeToCrop = ActiveWindow.Selection.ShapeRange(1) 
With shapeToCrop.Duplicate 
 .ScaleHeight 1, True 
 origHeight = .Height 
 .Delete 
End With 
cropPoints = origHeight * percentToCrop / 100 
shapeToCrop.PictureFormat.CropBottom = cropPoints

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。