gmcfad Posted November 3, 2017 Posted November 3, 2017 Trying to open MSWord with a specific document. I've tried both of the solutions below and all I get are the errors: $sWordFile = "C:\Users\gm185170\Desktop\Daily.doc" FileChangeDir ("C:\Users\gm185170\Desktop") Run("C:\Program Files (x86)\Microsoft Office\root\Office16\Winword.exe " & $sWordFile) ERROR: Sorry, we couldn't find your file. Was it moved, renamed, or deleted? (C:\Users\gm185170\Desktop\Daily.doc) Run(@ComSpec & ' /c Start "" "' & @MyDocumentsDir & '\Daily.doc"', @SystemDir, @SW_HIDE) ERROR: 'Windows cannot find 'C:\users\gm185170\Documents\Daily.doc'. Make sure you typed the name correctly, and then try again. I have multiple copies of the doc file on both my desktop and in my documents dir.... thanks
Moderators JLogan3o13 Posted November 3, 2017 Moderators Posted November 3, 2017 @gmcfad welcome to the forum. Try something like this: ShellExecute(@MyDocumentsDir & "\Daily.doc") It works well when I place a file named Daily in that directory. If that does not work for you, it is something specific to your system. You'll need to confirm Word is set to open .doc files by default. As an aside, once you get past this hurdle, if you are looking to manipulate the Word document after opening, have a look at the _Word* functions in the help file. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
gmcfad Posted November 3, 2017 Author Posted November 3, 2017 Tried you recommendation - received the same error: 'Windows cannot find 'C:\users\gm185170\Documents\Daily.doc'. Make sure you typed the name correctly, and then try again. Verified that Word is default prog for .doc file types.
water Posted November 3, 2017 Posted November 3, 2017 Did you verify that the file really exists in this Directory? Is it a .doc or a .docx file? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
gmcfad Posted November 9, 2017 Author Posted November 9, 2017 Major DUH! moment....HA! HA! The file name is Daily.doc.docx.........my bad. )-: And the shellexecute works fine. Thanks!!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now