Jump to content

Pasting images to ms doc


Recommended Posts

Hi all,

Is there any way to have a script that loops through a bunch of images in a folder, then open a word document and paste each image in a folder into a separeate document?

I have images in a directory and need to add a header in a word document and paste the image below the header. This process needs for every image in the directory, one document with a different header.

can anyone give me an idea of how to go about it?

Thanks

Just another special date with a different challenge

Link to comment
Share on other sites

Hi all,

me again.

I was able to find a vba script that opens a word document, create a table and place an image inside the table. At least thats a start. can anyone help me translate this code into autoit code?

Thanks.

Dim WordApp1 As Word.Application
    Dim WordDoc1 As Word.Document
    Dim myRange As Word.Range
     
    Set WordApp1 = CreateObject("Word.Application")
    WordApp1.Visible = True
     
    Set WordDoc1 = WordApp1.Documents.Add
     
    With WordDoc1
        Dim myTable As Word.Table
        Set myRange = .Range(Start:=0, End:=0)
        Set myTable = .Tables.Add(Range:=myRange, NumRows:=2, NumColumns:=1)
         
        myTable.Cell(2, 1).Range.InlineShapes.AddPicture "H:\Process Flow\result\sample.TIF"
         
    End With
    WordApp1.Quit False
     
    Set WordApp1 = Nothing
    Set WordDoc1 = Nothing

Just another special date with a different challenge

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...