当循环通过所有图像时,如何指示当前正在处理的图像?



我想使用VBA在文档中逐个更改图像的宽度。我需要手动判断当前的图像是否应该改变或不与是或否消息框时,循环通过。下面列出了当前的代码,它可以工作,但问题是WORD没有指示哪个图像是当前的。谢谢!

Sub change_images()
Dim iShp As InlineShape
For Each iShp In ActiveDocument.InlineShapes
With iShp
If .Type = wdInlineShapePicture Then
iShp.Select
CarryOn = MsgBox("Change current image?", vbYesNo, "")
If CarryOn = vbYes Then
.LockAspectRatio = msoTrue
.Width = 28.345 * 12
End If
End If
End With
Next
End Sub

我试图在MsgBox行之前添加。select,但通常在代码运行时无法查看选择标记。

iShp.Select
Application.ScreenRefresh

可以通过使用ScreenRefresh方法来解决。

最新更新