Question

Locked

VBScript for Word document automation

By tsettefrati ·
I have a VBScript that handles the generation of multiple Word documents. It opens a Word Template with form fields and Mail Merge REF fields. The REF fields point to the bookmark of one of the form fields.

I have the form fields marked as "Calculate on Exit" so that the Ref fields are automatically updated if the template is protected. However, Word requires keyboard input for this to work. If the template is not protected, each ref field has to be selected and updated manually.

We want the user to have as little contact as possible with the content of the document. Is it possible, through VBScript, to either simulate keyboard input in the word document (to simulate the "Tab" key being hit to exit the field) or to update the Ref fields?

Thanks for your help.

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Sending Keystrokes using vbscript

by MartMan In reply to VBScript for Word documen ...

Hi,

Vbscript supports sending of keystrokes by using the SendKeys Method. First you need to activate the application you want to send the keystrokes to by using the AppActivate method.
I have loaded an example for you at TheScriptLibrary.com using this url:

http://www.thescriptlibrary.com/default.asp?Action=Display&Level=Category3&ScriptLanguage=VBScript&Category1=Scripting%20Techniques&Category2=Retrieving%20Input&Title=Send%20Keystrokes%20to%20an%20Application%20using%20AppActivate%20SendKeys

Best Regards,
Marty Lindsay
Editor,
TheScriptLibrary.com

Back to Peripheral Forum
2 total posts (Page 1 of 1)  

Hardware Forums