
Using Word from a Visual Basic program launched from the web
I have a
Visual Basic program that is launched from the web and which
launches Word. I can create a file in Word and perform any of the
methods like fileOpen and FileClose, but cannot use statements like
ActiveDocuments and Selection.
'this code works
Set word = CreateObject("Word.Basic")
word.FileOpen("C:\Temp\temp.doc")
word.Insert("Hello")
word.FileClose
'this code does not - it gets lost when it reaches ActiveDocument
Set word = CreateObject("Word.Basic")
word.FileOpen("C:\Temp\temp.doc")
word.Insert("Hello")
ActiveDocument.Tables.Add Range:=myRange, NumRows:=NumberOfRows,
NumColumns:=NumberOfColumns
word.Insert ("Hello again")
word.FileClose
If anyone can give me suggestions on what to use instead of
ActiveDocument or Selection, it will be highly appreciated.
Thanks,
Sonia