我有以下代码:
Sub ImageInsert()
Application.ScreenUpdating = False
Dim Rng As Range, Shp As Shape, StrImg As String
StrImg = "filepath"
Set Rng = Selection.Range
Rng.Collapse
Set Shp = ActiveDocument.InlineShapes.AddPicture(FileName:=StrImg, _
SaveWithDocument:=True, Range:=Rng).ConvertToShape
With Shp
.LockAspectRatio = True
.RelativeHorizontalPosition = wdRelativeHorizontalPositionMargin
.Left = wdShapeRight
.RelativeVerticalPosition = wdRelativeVerticalPositionMargin
.Top = wdShapeBottom
.WrapFormat.Type = wdWrapTopBottom
End With
Set Rng = Nothing: Set Shp = Nothing
Application.ScreenUpdating = True
End Sub
问题是,我想将图像插入文档中的所有页面,而不是仅插入所选页面。我尝试更改范围,但似乎不起作用。
提前致谢!
答案1
对于想要在所有页面上显示的图像,应将其放置在页眉区域。您不需要宏即可执行此操作。