Jump to content
Sign in to follow this  
wardw

Word 2007 files don't open

Recommended Posts

I'm a new user of AutoIt, and I'd like my first script to open a few files for me. I can open a .txt file and a .pdf file just fine, but when Word opens it can't find the file I've specified. Here's the code I'm using. The same code works fine for the .txt and .pdf files, with file and path modifications:

 

$program_location = "C:Program Files (x86)Microsoft OfficeOffice12WINWORD.EXE"
$file_location = "C:EditingEditing Contract.docx"
Run ( $program_location & " " & $file_location & "")

 

Along with the other two files, Word (2007) opens, but in Word an alert appears: "This file could not be found. (C:EditingEditing.doc)". Clicking OK opens another alert: "This file could not be found. (C:UsersWardDesktopContract.docx)". Clicking OK opens Word with a new, blank document. It looks as if the script has trouble with the space in "Editing Contract.docx", although the other files that open successfully also have spaces in their filenames. Is there a way to comment out the space (I don't want to change the filename).

I'm using Windows 7.

Share this post


Link to post
Share on other sites

Depending on what you try to do with the Word doc there is an UDF (User Defined Functions) available. The UDF that comes with AutoIt doesn't work well with docx files. But there is a WordEX UDF available (for download please see my signature).


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-08-19 - Version 1.4.13.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-07-24 - Version 1.3.6.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (NEW 2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Taks Scheduler (NEW 2019-10-09 - Version 0.9.0.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

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  

×
×
  • Create New...