我在Microsoft Publisher中创建了一个模板,上面有几个"图片占位符"。我已经阅读了文档,但不知道如何以编程方式设置占位符的图像。
Private Sub Document_Open()
Dim shp As Shape
For Each shp In ActiveDocument.Pages(1).Shapes
If shp.AlternativeText = "Image1" Then
' I want to set the image here, something like shp.Image = "C:blah.jpg"
Debug.Print ("Got to image 1")
ElseIf shp.AlternativeText = "Image2" Then
Debug.Print ("Got to image 2")
Else
End If
Next shp
End Sub
对于任何想知道答案的人,我都能弄清楚:
shp.PictureFormat.ReplaceEx ("FilePath")