Jump to content

Recommended Posts

I can attach to a word document using the search text and file name modes in a test environment (just to see if it works).

However, I only know the file handle (which I get from WinList) and I know the title. Using the handle and Title modes just wont work.

$WordApp = _WordAttach ("Doc text, "Text")----------------> this works, cant use it

$WordApp = _WordAttach ("Doc22.doc", "FileName")-----> this works, cant use it

$WordApp = _WordAttach ("0x001B0402", "HWND")-------> No Go!!!!!

$WordApp = _WordAttach ("Titlebar text", "Title")----------> No Go!!!!!

Thanks for any help

Edited by AutoitMike
Link to comment
Share on other sites

Change the "My Doc" test in here to match your doc name and see if it works...

#include <Array.au3>
#include <Word.au3>

$list = winlist()
_ArrayDisplay($list)

For $x = 1 to $list[0][0]
    If $list[$x][0] = "My Doc - Microsoft Word" Then
        $handle = $list[$x][1] ; My Doc.doc is open at runtime
        Exitloop
    EndIf
Next
$oWord = _WordAttach($handle, "HWND")
If IsObj($oWord) then MsgBox(0,"","Success!")

If it does not, then post the code you're testing with, and tell us what OS and version of Office you're running, and I'm sure someone will fix you up.

Edited by Spiff59
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...