| View previous topic :: View next topic |
| Author |
Message |
hotzenpl0tz
Joined: 22 Oct 2007 Posts: 11
|
Posted: Tue Nov 13, 2007 2:29 pm Post subject: COM and Word.Application - How do I call "document" |
|
|
Hello, I am trying to automate the insertion of several values I parsed from a webpage using COM (probably the most reliable way to get this working on several machines, at least I hope so).
I tried the following:
| Code: |
word := COM_ActiveXObject("Word.Application")
COM_Invoke(word, "visible=", "true")
COM_Invoke(word, "Open", "c:\test.dot")
|
The "visible" part works. The Open Method doesn't get called, I suspect it is because the visible method is not part of the Word.Application Object, but a sub-object called documents. The vbscript equivalent I would be calling here is:
| Code: |
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Open("c:\scripts\inventory.doc") |
Can somebody help me out here, how I would get the handler for the documents object so I can call the method ?
I suspect I would have to do something with COM_Queryinterface and maybe use the IID of the document object ? If so, how do I get the ID ?
Thanks alot ! |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1397
|
Posted: Tue Nov 13, 2007 3:15 pm Post subject: Re: COM and Word.Application - How do I call "document& |
|
|
| hotzenpl0tz wrote: | | Code: | Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Open("c:\scripts\inventory.doc") |
|
Verbatim translation:
| Code: | objWord := COM_CreateObject("Word.Application")
objDoc := COM_Invoke(COM_Invoke(objWord, "Documents"), "Open", "c:\scripts\inventory.doc")
|
| Quote: | | I suspect I would have to do something with COM_Queryinterface and maybe use the IID of the document object ? |
I don't think VBS has the function of QueryInterface. |
|
| Back to top |
|
 |
hotzenpl0tz
Joined: 22 Oct 2007 Posts: 11
|
Posted: Tue Nov 13, 2007 3:34 pm Post subject: |
|
|
| Thanks alot Sean, helped me out immensely ! |
|
| Back to top |
|
 |
|