我已经阅读了几个论坛,但他们都没有为我工作。禁用锁定长宽比VBA - Excel
我从网上拉图片,并将它们插入我的电子表格。我希望所有这些图片具有相同的尺寸。
我的代码如下:
Dim img_url as string, picture as object
img_url = Range("A1") 'Some url with an img
With ActiveSheet.Pictures
Set Picture = ActiveSheet.Pictures.Insert(img_url)
Picture.LockAspectRatio = msoFalse
Picture.Width = 25
PictureHeight = 25
End With
我每次运行它,锁定纵横比的设定仍然选中,并且图像不是我要找的方格式。
任何意见将不胜感激。
由于
'PictureHeight'应该是'Picture.Height'吗?另外,With'块似乎是多余的。 – jsheeran
'LockAspectRatio = msoFalse'是'Shape'对象库的成员 –
@marldog在 –