Jump to content

MS Word - Checkbox?


Recommended Posts

I'm currently working on a script to transpose some data from an Excel file onto multiple Word documents.

Getting the Excel data is easy and transposing the text is also relatively easy.

The problem I'm currently encountering is the fact that the Word document has a checkbox that I need to check or not check depending on one of the values in the Excel field.

Is it possible to do this task? I tried to use the AutoIT Window Info but could not determine a handle or something I can grab onto.

Any ideas/thought/suggestions are appreciated.

-Work Smarter, Not Harder, Use More AutoIT

Link to comment
Share on other sites

Use the mouse? The info tool will give the coords.

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Link to comment
Share on other sites

MSDN say anything on using COM to hook into the doc? You could look at word.au3 to see how it works to give you some direction.

I should have checked MSDN first, but for anyone else who would like to know, below is how to do it. Thanks Volly.

In the Word form, ensure that the checkbox has a Bookmark named in Field Settings.

Then the below code will work:

#include <Word.au3>

$oWord = _WordAttach(<Word Doc>)
$oWord.Activedocument.FormFields(<BookMark>).CheckBox.Value = True
Exit

-Work Smarter, Not Harder, Use More AutoIT

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...