Jump to content
Sign in to follow this  

Word interaction query [solved]

Recommended Posts


Ok it's not strictly an Autoit question but it relates to using the word com object from my autoit prog.

I need to delete the contents of a word document and replace it with a short message.

I've tried playing with range.text but this doesn't include the tables etc., though it's fine for adding the message

The VBA would be something like

Selection.HomeKey Unit:=wdStory

or perhaps


How do i convert this to Autoit?

I'd thought something like

                 $oWordApp.ActiveDocument.Range.Text = "Cancelled by user "&@YEAR&@MON&@MDAY&@HOUR&@MIN&@SEC

The range.txt bit works on its own by replacing the old text with the message, but I can't get the same thing to work on the entire document - using wholestory in place of range.text just gives a com error.

Any suggestions, anyone?



Edited by saywell

Share this post

Link to post
Share on other sites

Solved after more searching around

$oWordApp.ActiveDocument.Range.Text= "Cancelled by user "

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

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.