Saturday, March 6, 2010

VBScript - Inserting / copying images to a word file

VBScript - Inserting / copying images to a word file

Copying images from c:\ to a word file

Set objWord = CreateObject("Word.Application")
objWord.Visible = True
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection

set obr = objDoc.Range()
Set objShape = objDoc.inlineShapes

i=3

do while i > 0

objShape.AddPicture("C:\test" & i & ".bmp")
objWord.Selection.TypeParagraph()
i=i-1

loop

Also See:

Opening a new word document
Opening an existing word document
Opening a new word document and writing text to it
Opening an existing word document and appending text to it at the end.
Opening an existing word document and appending text to it at the beginning.
Saving a new word file
Saving an existing word file
Writing formatted text to a word file
Formatting all content, formatting specific paragraphs or finding and formatting specific text in a word document
Creating table in a word document, adding text to cells, adding rows to table
Printing a word file