Add picture to bookmark


Sub UpdateBookmarkedImage(BmkNm As String, NewTxt As String)
Dim BmkRng As Range
With ActiveDocument
  If .Bookmarks.Exists(BmkNm) Then
    Set BmkRng = .Bookmarks(BmkNm).Range
    If  BmkRng.InlineShapes.Count >0 then 
        BmkRng.InlineShapes(1).Delete
    End if
    BmkRng.InlineShapes.AddPicture FileName:=NewTxt
    .Bookmarks.Add BmkNm, BmkRng
  End If
End With
Set BmkRng = Nothing
End Sub
Advertisements