Excel – VB Script – Calling Excel 2007 explicitly when both Excel 2003 and Excel 2007 are installed

excelrowvbscriptversion

My PC has both Excel 2003 and 2007 as well as the Excel 2007 compatibility pack installed, it also has a VB script that build records into an csv file automatically. Recently, the number of records that are needed to dump into the file has grown significantly and went beyond the row limit in Excel 2003. As such, I made a copy of the same file and saved it into .xlsm format.
However, when I use the VBScript to run the macro behind the Excel spreadsheet by calling:

Set myApp = CreateObject("Excel.Application")

The Excel file still attempted to open itself to convert (using the compatibility pack) to Excel 2003 and run in Excel 2003, which inevitably gives an error every time it runs.

Is there any way I could force Excel.Application to point to Excel 2007 instead of Excel 2003?

Thanks!

Best Answer

I had a similar experience, I am running office 2010 and i want to use the Office agents available until Office 2003. so I installed Excel 2003 on my box and i didnt worked.

I found this post and tried all options. reaseaching i found that i should use:

Set myApp = CreateObject("Excel.Application.11") 

for office 2003 but it didnt work.

All my testing was done in VBSedit software, which shows that it was using the office 2003, but it was actually opening 2007.

I tried with primalscript and is working like a charm.

I think this might help others.

Related Topic