Jump to content
AuroraDaveF

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

Recommended Posts

AuroraDaveF

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
water

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:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

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

×