Consulting

Results 1 to 4 of 4

Thread: VBA CODE FOR SELECTING PICTURE FROM A SPECIFIC FOLDER

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Angry VBA CODE FOR SELECTING PICTURE FROM A SPECIFIC FOLDER

    Hello,guys
    You have any ideas why this code doesn't work? Is to put pictures into a word document from a specific folder... Thanks...
    Sub GetPictures()
        Dim sPic As String
        Dim sPath As String
    
        sPath = "c:\myfolder"
        sPic = Dir(sPath & "*.jpg")
    
        Do While sPic <> ""
            Selection.InlineShapes.AddPicture _
              FileName:=sPath & sPic, _
              LinkToFile:=False, SaveWithDocument:=True
            sPic = Dir
            Selection.TypeParagraph
            Selection.TypeParagraph
        Loop
    End Sub
    Last edited by Aussiebear; 02-23-2022 at 02:13 AM. Reason: Added code tags to supplied code

Posting Permissions

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