我有这样的代码:
Selection.InlineShapes.AddPicture FileName:=path & "\" & "image.png", LinkToFile:=False, SaveWithDocument:=True
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.InlineShapes.Item(1).ScaleHeight = 80
Selection.InlineShapes.Item(1).ScaleWidth = 80但是出现了一条5941错误消息:
运行时错误'5941‘集合的请求成员不存在。
我想设置特定的高度和宽度。
我怎么才能修好它?
发布于 2017-10-23 11:28:25
您可能想看看这。以下是该网站的评论:
基本要素: 使用关联形状容器的.ScaleHeight和.ScaleWidth属性调整图片的大小。此属性确定要缩放图像的相对于原始图片大小的百分比大小。 示例: 以下代码将图片高度调整为原始图片高度的90%:
InlineShapes.Item(1).ScaleHeight = 90
或者,您可以在创建图像时更改大小:
ActiveDocument.Shapes.AddPicture FileName:=path & "\" & "image.png", _
LinkToFile:=False, _
SaveWithDocument:=True, _
Left:=-0, _
Top:=0, _
Anchor:=Selection.Range, _
Width:=50, _
Height:=50https://stackoverflow.com/questions/46887599
复制相似问题