M
Modeerf60
I have been successful in moving data from Excel to Word in VB. From Excel
(2003 running on Windows XP Pro) I am able to create several Word files from
the same starting Word form. Now, using Excel VB, I need to connect these
files into one Word report and have three questions.
1) End of document
I need to move the insertion point to the end of the first file before I
insert the second file. I’ve recorded a macro in Word and tried the following:
WordApp.ActiveDocument.Selection.EndKey Unit:=6
But it does not work. Do you know what will work? Please provide code
examples.
2) Append Files
Then I need to append the next file. From the same Word macro I recorded I
have tried:
WordApp.ActiveDocument.Selection.InsertFile Filename:="File1.doc"
But it does not work. Do you know what will work? Please provide code
examples.
3) Insert Text
After they are all appended together, I need to insert some text before I
save and close the file. From the same Word macro I recorded I have tried:
WordApp.ActiveDocument.Selection.TypeText Text:="Text to be inserted"
But it does not work. Do you know what will work? Please provide code
examples.
Many Thanks
M
(2003 running on Windows XP Pro) I am able to create several Word files from
the same starting Word form. Now, using Excel VB, I need to connect these
files into one Word report and have three questions.
1) End of document
I need to move the insertion point to the end of the first file before I
insert the second file. I’ve recorded a macro in Word and tried the following:
WordApp.ActiveDocument.Selection.EndKey Unit:=6
But it does not work. Do you know what will work? Please provide code
examples.
2) Append Files
Then I need to append the next file. From the same Word macro I recorded I
have tried:
WordApp.ActiveDocument.Selection.InsertFile Filename:="File1.doc"
But it does not work. Do you know what will work? Please provide code
examples.
3) Insert Text
After they are all appended together, I need to insert some text before I
save and close the file. From the same Word macro I recorded I have tried:
WordApp.ActiveDocument.Selection.TypeText Text:="Text to be inserted"
But it does not work. Do you know what will work? Please provide code
examples.
Many Thanks
M