Jump to content

Autoit3x.dll in MS Word VBA


Recommended Posts

I'm trying to run Autoit within a Word macro. Most of it works but I can't get it to recognise a Wizard Window with Winwait or Winwaitactive. The script just hangs at that point and then continues when I close the window.

Any thoughts anyone?

[u][font="Arial"]Pete[/font][/u]
Link to comment
Share on other sites

Thanks Larry but nothing seems to work. The whole VB macro hangs until I cancel the "Send Fax Wizard" window then script carries on from there. I can't even get it to mouseclick until I've closed the window.

I'm trying to navigate through the Send Fax Wizard widows without having to manually input or click. It just won't recognise the windows even though the spy does.

:D

[u][font="Arial"]Pete[/font][/u]
Link to comment
Share on other sites

Jon

This is my macro taken from Word. Instead of the part communicating with the Wizard window I've included a notepad test - that does work.

The window for the Fax wizard still doesn't register.

Sub SendtoFax()
Dim strStyle(3) As String, strText(3) As String, x As Long
Dim ctlAuto As New AUTOITX3Lib.Control, strWords As String
strStyle(1) = "Company"
strStyle(2) = "FaxNum"
strStyle(3) = "Subject"
Dim strTitle As String
For x = 1 To 3
Selection.HomeKey unit:=wdStory
Selection.Find.ClearFormatting
 Selection.Find.Style = Activedocument.Styles(strStyle(x))
 With Selection.Find
        .Text = ""
        .Forward = True
        .Wrap = wdFindStop
End With
Selection.Find.Execute
    If Selection.Find.Found = True Then strText(x) = Selection
 Next x
    MsgBox strText(1) & " " & strText(2) & " " & strText(3)
Printon "Fax"
ctlAuto.Run "notepad.exe"
ctlAuto.WinWait "Untitled - "
ctlAuto.Send "test"

End Sub
[u][font="Arial"]Pete[/font][/u]
Link to comment
Share on other sites

Larry

if you choose the Windows 2K built in fax as your printer to fax a document, it comes up with a window called "Send Fax Wizard". This asks you to insert Name and Fax No and then you click "finish" and it sends the fax.

I can't get automation to work in VBA and I thought I could use Autoit to insert the text and click the buttons.

It won't work.

[u][font="Arial"]Pete[/font][/u]
Link to comment
Share on other sites

I've discovered that the "Send Fax Wizard" window is modal which suspends actions until it is clicked. That's why the script doesn't work.

Does anyone know a way round this?

[u][font="Arial"]Pete[/font][/u]
Link to comment
Share on other sites

I've discovered that the "Send Fax Wizard" window is modal which suspends actions until it is clicked. That's why the script doesn't work.

Does anyone know a way round this?

I'm no expert but what does autoit spy tell you about using controlclick

Rick

Link to comment
Share on other sites

Thanks for your responses. I've now worked out how to operate automation with FaxCom.dll so in this case I don't need Autoit3.

I do still think Autoit is indispensible and I've done my bit on download.com

[u][font="Arial"]Pete[/font][/u]
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

  • Recently Browsing   0 members

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