Jump to content

Word interaction query [solved]


saywell
 Share

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

or perhaps

Selection.WholeStory
Selection.Cut

How do i convert this to Autoit?

I'd thought something like

$oWordApp.ActiveDocument.Selection.WholeStory
                 $oWordApp.ActiveDocument.Selection.Cut
                 $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?

Regards,

William

Edited by saywell
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...