Jump to content

Recommended Posts

Posted

The following code should open a Word document selected by the user, and that document should end up being the active window.

#include <word.au3>

$path=fileopendialog("Choose File",@desktopdir,"Word Documents (*.doc)")
$wObj=_wordcreate($path)
$wWin=wingethandle($wObj)
winactivate($wWin)
winwaitactive($wWin)

What actually happens is this: the document opens and is the foremost window, but it is grey on the top, i.e., not active. What can I do to make the document end up being active?

Posted

:BUMP:

I still haven't been able to get this to work. MikeP, I can't use your solution because it doesn't work properly if I have another window with the word "Word" in its title.

I'm getting a confusing result when I test the data in $wObj. With this code:

#include <word.au3>

$path=fileopendialog("Choose File",@desktopdir,"Word Documents (*.doc)")
$wObj=_wordcreate($path)
$wWin=WinGetTitle($wObj)
msgbox(0,"",$wWin)
winactivate($wWin)
winwaitactive($wWin)

the MsgBox() shows the path for the script that I'm running, not the Word doc that I chose with FileOpenDialog().

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...