Open Excel xlsx using create object in vba excel

Both Excel 2003 and Excel 2007 are installed on a  machines
How to control the object version open when this script line is executed ?
Set appXL = CreateObject("Excel.Application")
i have xlsx file but it opens in excel 2003.
how to open in 2007 using vba.

thanks
yking
RAJ4UAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris BottomleySoftware Quality Lead EngineerCommented:
It's as easy as adding the identifier:

'Set to 2003
'Set appXL = CreateObject("excel.application.11")
'set 2007
Set appXL = CreateObject("excel.application.12")

Chris
0
jkpieterseCommented:
Chris: unfortunately, the version number in the createobject line is ignored.
yking: From what application are you running this code?
0
Chris BottomleySoftware Quality Lead EngineerCommented:
Jan

Why  do you say that ... I have just tested on two machines, 1 of each install and they error out on the uninstalled version but work with the correct version - indicating it does work.

Chris
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Rory ArchibaldCommented:
Chris,
If you have both versions on one machine, the version number is ignored as JK said. There is no way to specify which version you want loaded using Automation (that I know of) - you need to shell the version, then use GetObject to grab the file reference.
Rory
0
Chris BottomleySoftware Quality Lead EngineerCommented:
Jan / Rory

I'm rich enough to have 1 machine per version, (hah!, work machine and mine) so I haven't had the chance to experience that, at least that's something to pin down in my knowledge banks now - thanks

Chris
0
RAJ4UAuthor Commented:
hi kpieterse,
i am using access 2007  vba to launch the excel object.
0
RAJ4UAuthor Commented:
rorya,
if i opened xls in 2003 and launch using shell excel 2007 then which one it will take as get object.

0
Rory ArchibaldCommented:
You pass the workbook name to getobject and then you get a reference to that workbook.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.