Micro Focus QTP (UFT) Forums
Automating Word Docs - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Automating Word Docs (/Thread-Automating-Word-Docs)



Automating Word Docs - bart02 - 07-18-2014

Hi-

My application under test (AUT) launches Word and creates a document with a randomized name. What I want to do is search through the open document for a string of text.
And if I do the following...

Code:
Set oWord = GetObject( ,\"Word.Application\")
Set oDoc = oWord.ActiveDocument

I get an error saying \"This command is not available because no document is open\" even though Word is open on my machine and there is a doc open.

So my question is – how do you use automation to access Word Documents not launched by the VBscript in QTP? How do you get to existing open Word instances?

Any help would be greatly appreciated. THANKS!!

Tim