PDA

View Full Version : Create Excel Object 2003 or 2007



stanl
10-21-2011, 06:43 AM
I combined Excel 2007 and 2003 on a single XP machine. I have no problem opening either app from the start menu and can use the SaveAS fileformat:= to save as either a 2003 or 2007 file. I also know the CLSID is the same so a CreateObject("Excel.Application") will default to the higher version.

Still, I read that by manipulating a couple of registry keys, you could issue either

CreateObject("Excel.Application.11") ;2003
CreateObject("Excel.Application.12") ;2007

but after doing this, Excel still opens as 2007. This is a relative non-issue as all code to automate workbooks still works, but I was hoping I could run some legacy stuff and have Excel 2003 open.

This is probably a lost cause, but I thought I'd ask in case someone has figured it out.

TIA

Aflatoon
10-21-2011, 09:11 AM
The only way I am aware of that you can launch a specific version, is to use Shell and pass the actual path to the excel.exe file. The drawback to this is that you do not get a reference to a COM object. If you need that then you will either need to use GetObject with a file path to a file you know is open in that instance, or use API calls to iterate through the open windows and grab an accessible object from a window in the application instance.

stanl
10-21-2011, 11:06 AM
I thought so. Thanks