Consulting

Results 1 to 2 of 2

Thread: Insert Image after Text in Text Field

  1. #1
    VBAX Newbie
    Joined
    Jun 2023
    Posts
    1
    Location

    Insert Image after Text in Text Field

    Hi,

    I have the following function to insert an image into a Text Field:

    Private Sub InsertPicture(filename As String)
        
        With ActiveDocument.Shapes(activeTextbox).TextFrame.textRange
            .InlineShapes.AddPicture filename:=filename, _
            LinkToFile:=False, SaveWithDocument:=True
        End With
        
    End Sub
    Now I want to insert the image below the text in the text Field and I guess for that I have to make
    use of the 'Range' parameter of the AddPicture function. But I dont know how to do it.

    Can someone help me out?

    Thanks

  2. #2
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,353
    Location
    Private Sub InsertPicture(filename As String)
    Dim oRng As Range
        With ActiveDocument.Shapes(1).TextFrame
          Set oRng = .TextRange
          oRng.Collapse wdCollapseEnd
            oRng.InlineShapes.AddPicture filename:=filename, _
            LinkToFile:=False, SaveWithDocument:=True
        End With
        
    End Sub
    Greg

    Visit my website: http://gregmaxey.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •