1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
Private Sub Update_Picture(MyWordApp As Word.Application, _
MyWordDoc As Word.Document, _
MyBookMark As String, _
MyFilename As String)
' Check if the Bookmark exists in the Word.Document Object
If MyWordDoc.Bookmarks.Exists(MyBookMark) Then
' Check if the filename is valid
If Dir(MyFilename, vbDirectory) = vbNullString Then
MsgBox "Error Filename: " & MyFilename & " doesn't exist!", vbCritical
Else
' Select the Bookmark
MyWordDoc.Bookmarks(MyBookMark).Select
MyWordApp.Selection.InlineShapes.AddPicture Filename:=MyFilename, SaveWithDocument:=True
End If
End If
End Sub |