View Single Post
 
Old 02-15-2022, 10:14 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,144
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 ofgmayor has much to be proud of
Default

You need to save the image from the userform as a temporary file then insert that temporary file at the bookmark.

Call the image using the following sub as follows:
Code:
UserformImageToBM "Proposal", Image1.Picture
Code:
Private Sub UserFormImageToBM(strbmName As String, oImage As Object)
'Graham Mayor - http://www.gmayor.com
'UserformImageToBM "bookmarkName", Image1.Picture
Dim oRng As Range
Dim TempFile As String
Dim FSO As Object
    Set FSO = CreateObject("Scripting.FileSystemObject")
    TempFile = Replace(FSO.GetTempName, "tmp", "bmp")
    SavePicture oImage, TempFile
    With ActiveDocument
        On Error GoTo lbl_Exit
        Set oRng = .Bookmarks(strbmName).Range
        oRng.Text = ""
        oRng.InlineShapes.AddPicture _
                FileName:=TempFile, LinkToFile:=False, _
                SaveWithDocument:=True
        oRng.End = oRng.End + 1
        oRng.Bookmarks.Add strbmName
    End With
    Kill TempFile
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