scooter2028 Posted December 28, 2013 Share Posted December 28, 2013 I have Word 2003 and 2010 on my system and need both. Trying to write script to open word file and use $word = ObjCreate("word.application") $word.visible = True $word.Documents.open("C:test.docx") This opens 'test.docx' file in Word 2003. How can I force to open in Word 2010? Actually, the 2003/2010 decision is made on the 'ObjectCreate' command. By eliminating the last line ('Open') Word brings up the 2003 version just based on the first 2 lines. So I suppose the fix has something tho do with what "word.application" is pointing to. Running AutoIT v3.3.10 Thanks Roy Link to comment Share on other sites More sharing options...
JohnOne Posted December 28, 2013 Share Posted December 28, 2013 Try Word.Application.10 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
scooter2028 Posted December 28, 2013 Author Share Posted December 28, 2013 In the registry, Word 2003 is identified as word.application.11, Word 2007 as word.application.12 and Word 2010 as word.application.14. I tried all of them in the script. ex: '$word = ObjCreate("word.application.XX")' Here's what happened: word.application.11 -> Opened in Word 2003 as expected since '11' is Word 2003 word.application.12 -> Opened in Word 2003 word.application.14 -> Opened in Word 2003 word.application.10 -> Generated an error on the line: '$word.visible = true' complaining that '$word' wasn't an object. So I suspect word.application.10 couldn't be resolved to anything it knows about. (Word 2007 was never installed on this system but some components to read Office 2007 files were.) Link to comment Share on other sites More sharing options...
JohnOne Posted December 28, 2013 Share Posted December 28, 2013 I'm unsure if you can use the GUID of word 2010. If you can you'd have to find it in the registry I think. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
JohnOne Posted December 28, 2013 Share Posted December 28, 2013 msdn says if you don't specify a version it should start the latest version installed. I don't know if that means highest version or last installed. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
iamtheky Posted December 28, 2013 Share Posted December 28, 2013 (edited) whats it say in the registry here: HKEY_CLASSES_ROOT.docx or HKLMSoftwareclasses if maybe a file association issue. Edited December 28, 2013 by boththose ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
scooter2028 Posted December 29, 2013 Author Share Posted December 29, 2013 Just solved - see below. Re: 'BothThose' file associations. In the Control Panel went into 'Default Programs' and then 'File Associations' Both .doc and .docx were associated with Word 2003. Kept trying to change them and neither one would take. The change would appear to have worked but if you checked immediately thereafter it showed Word 2003. See the 'Solved' for more on this. Solved: Googling file association issues in general, someone suggested going to Control Panel/Programs and 'repairing' the MS Office 2010 install. Did that and lo and behold 'word.application' now presents me with Word 2010 which is what I was trying to get to all along. Checking the 'file associations' for .doc and .docx show them associated with Word 2010. Too bad I don't know exactly what changed that fixed it. And also don't know why a 'repair' had to be done to change the file associations. Thanks for everyone's input. Link to comment Share on other sites More sharing options...
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