Jump to content

Script to watch for Winword 2010 then click a toolbar/ribbon button

Recommended Posts


Hi, my brain is absolutely swimming and I'm having no luck trying to get my head around AutoIt and VBA macros at the same time.

I need AutoIt to detect when a/any file opens in MS Word 2010 opens and when it does, to click a button on the Word toolbar (that will run a macro that makes some changes to make the file compliant, saves the file and closes word).

I have the Word macro done and tested.  I plan to open a list of files in word using a simple DOS batch file.  I've had no luck making AutoOpen work in Word macros, so I'm hoping Openit can help me out.

I've not been able to work out how to make AutoIt to detect word has opened a file (as opposed to opened to just Document 1), or how to click the right bits of the toolbar.  Worst case scenario I can use the location of the button and make sure Word always opens full screen.  I think I can do that, but as I'm failing the other bits I'm not sure if I'm reading the data in the AutiIt window info either.

So, to the experts. I'd like a script to detect that Word has opened a file, bring up the View toolbar, then click the button to trigger the macro.  The batch file will then open the next file, repeat.

Please help.  Thanks


Share this post

Link to post
Share on other sites

Welcome to Autoit and the forum!

I would do the following:

  • Check why the macro isn't being executed when the document is opened. There are lots of sites exactly describing how to to this (like this one).
  • I suggest to use the Word UDF that comes with AutoIt if you need to automate Word from an external program
Edited by water

My UDFs and Tutorials:


Active Directory (NEW 2018-12-03 - Version - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki

ADO - Wiki


Share this post

Link to post
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