General
cancel
Showing results for 
Search instead for 
Did you mean: 

Microsoft, Visual Basic, Office program, how to get a reference from a Word created by a macro ??

Yu-Kang Tsao
Occasional Contributor

Microsoft, Visual Basic, Office program, how to get a reference from a Word created by a macro ??

Hello hp experts:

Does anyone know how can I get a reference for a Word.Document which is created by a microsoft built-in macro ? so that I can make some modification to that Word once I get a reference to it.

The thing is this:
In Visual Basic,
if you got

'-------------------------------
Dim pt As New PowerPoint.Application
pt.Commandbars.FindControl(Id:=684).Execute
'-------------------------------

It will open a Power Point file and pop out a window that let you choose the options and then it will convert that Power Point file to Word document. That newly created Word document will show as "Document1". but I need to make some modification to that file, so I need to get a reference to that newly created Word document. I try

Dim wordtest As Word.Document
Set wordtest = GetObject( , "Word.Document")

and it does not work. Does any one know how to get a reference for that newly created word document ? Thank you very much for your help.

Sincerely,

Nathan


Thanks.


Totally-Rebuilt by God