Sign in to follow this  
Followers 0
scooter2028

Two Vers. of Word on system 'word.application' points to 'wrong' one

7 posts in this topic

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

 

Share this post


Link to post
Share on other sites



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.)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

whats it say in the registry here: HKEY_CLASSES_ROOT.docx

or 

HKLMSoftwareclasses

if maybe a file association issue.

Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

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.

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  
Followers 0