Jump to content

Trouble using Word Document Functions


Recommended Posts

This is just for my own instructional purposes at this point.

Goal: To open an existing word ".doc" on my desktop named "Test.doc", and replace "EEE" with "FFF", add a Return, then save the document. This script runs without errors, but "EEE" is still in the document when I open it after the script is complete - Nothing changed.

Contents of "Test.doc", without the quotes obviously:

"This is just a test. AAA, BBB, CCC, EEE."

Contents of AutoIt Script:

$oWordApp = _WordCreate ("")

$oDoc = _WordDocOpen ($oWordApp, "C:\Documents and Settings\Owner\Desktop\Test.doc")

$oFind = _WordDocFindReplace($oDoc, "EEE", "FFF" & @CRLF)

_WordDocSave ($oDoc)

_WordQuit ($oWordApp)

Link to comment
Share on other sites

This is just for my own instructional purposes at this point.

Goal: To open an existing word ".doc" on my desktop named "Test.doc", and replace "EEE" with "FFF", add a Return, then save the document. This script runs without errors, but "EEE" is still in the document when I open it after the script is complete - Nothing changed.

Contents of "Test.doc", without the quotes obviously:

"This is just a test. AAA, BBB, CCC, EEE."

Contents of AutoIt Script:

$oWordApp = _WordCreate ("")

$oDoc = _WordDocOpen ($oWordApp, "C:\Documents and Settings\Owner\Desktop\Test.doc")

$oFind = _WordDocFindReplace($oDoc, "EEE", "FFF" & @CRLF)

_WordDocSave ($oDoc)

_WordQuit ($oWordApp)

There's no #include. What UDF are you using for the _Word* funcitons? Are there any errors on the SciTE console when you run it?

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...