R
Robert
Hi,
I need some hints for the following problem.
I have a VB 6 application that needs to write data (text and image) to a
Ms-Word document (template)
So I created a Ms-Word document with some bookmarks. The VB App is able to
write the data to the Ms-Word document and save it with a new doc-name.
But.this works only for one page. How to deal with a multiple page document.
Beforehand I don't know how much pages I need. One page contains a few text
lines and one image.
Can I define the image size ?
A piece of my (test)code.
' Project References = Microsoft Word 11.0 Object Library
Dim WordObj As Word.Application
Dim WordDoc As Word.Document
Dim WordRange As Word.Range
mydate$ = Date
Set WordObj = CreateObject("Word.Application")
Set WordDoc = WordObj.Documents.Open(App.Path & "\report.doc")
WordObj.Visible = True
'Date
Set WordRange = WordDoc.GoTo(What:=wdGoToBookmark, Name:="Date")
WordRange.InsertAfter mydate$ 'inserts the contents
'Photo
Set WordRange = WordDoc.GoTo(What:=wdGoToBookmark, Name:="photo")
WordRange.InlineShapes.AddPicture FileName:= myfile$, LinkToFile _
:=False, SaveWithDocument:=True
I need some hints for the following problem.
I have a VB 6 application that needs to write data (text and image) to a
Ms-Word document (template)
So I created a Ms-Word document with some bookmarks. The VB App is able to
write the data to the Ms-Word document and save it with a new doc-name.
But.this works only for one page. How to deal with a multiple page document.
Beforehand I don't know how much pages I need. One page contains a few text
lines and one image.
Can I define the image size ?
A piece of my (test)code.
' Project References = Microsoft Word 11.0 Object Library
Dim WordObj As Word.Application
Dim WordDoc As Word.Document
Dim WordRange As Word.Range
mydate$ = Date
Set WordObj = CreateObject("Word.Application")
Set WordDoc = WordObj.Documents.Open(App.Path & "\report.doc")
WordObj.Visible = True
'Date
Set WordRange = WordDoc.GoTo(What:=wdGoToBookmark, Name:="Date")
WordRange.InsertAfter mydate$ 'inserts the contents
'Photo
Set WordRange = WordDoc.GoTo(What:=wdGoToBookmark, Name:="photo")
WordRange.InlineShapes.AddPicture FileName:= myfile$, LinkToFile _
:=False, SaveWithDocument:=True