View Single Post
 
Old 12-12-2017, 06:01 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,106
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

You can't do this, but you could insert the image and add a bookmark to the image location, which will make it easier to address. The following should help

Code:
Public Sub ImageToBM(strbmName As String, strImagePath As String)
'Graham Mayor - http://www.gmayor.com
Dim orng As Range
Dim fso As Object
    Set fso = CreateObject("Scripting.FileSystemObject")
    If fso.FileExists(strImagePath) Then
        With ActiveDocument
            On Error GoTo lbl_Exit
            Set orng = .Bookmarks(strbmName).Range
            orng.Text = ""
            orng.InlineShapes.AddPicture _
                    FileName:=strImagePath, LinkToFile:=False, _
                    SaveWithDocument:=True
            orng.End = orng.End + 1
            orng.Bookmarks.Add strbmName
        End With
    End If
lbl_Exit:
    Set fso = Nothing
    Set orng = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote