VB脚本 - 在安装Excel 2003和Excel 2007时显式调用Excel 2007

时间:2021-09-18 09:12:33

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:

我的PC同时安装了Excel 2003和2007以及Excel 2007兼容包,它还有一个VB脚本,可以自动将记录构建到csv文件中。最近,转储到文件中所需的记录数量显着增长,超出了Excel 2003中的行限制。因此,我制作了同一文件的副本并将其保存为.xlsm格式。但是,当我使用VBScript运行Excel电子表格后面的宏时,通过调用:

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.

Excel文件仍尝试打开自身以将其转换(使用兼容包)到Excel 2003并在Excel 2003中运行,每次运行时都不可避免地会出错。

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

有什么办法可以强制Excel.Application指向Excel 2007而不是Excel 2003?

Thanks!

谢谢!

3 个解决方案

#1


2  

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.

我有类似的经历,我正在运行Office 2010,我想在Office 2003之前使用Office代理。所以我在我的盒子上安装了Excel 2003,但我没有工作。

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

我找到了这篇文章并尝试了所有选项。 reaseaching我发现我应该使用:

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

for office 2003 but it didnt work.

办公室2003年,但它没有工作。

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

我的所有测试都是在VBSedit软件中完成的,该软件显示它使用的是Office 2003,但它实际上是在2007年开放。

I tried with primalscript and is working like a charm.

我尝试过primalscript,并且像魅力一样工作。

I think this might help others.

我认为这可能有助于其他人。

#2


1  

Try:

尝试:

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

设置myApp = CreateObject(“Excel.Application.12”)

#3


1  

see http://support.microsoft.com/kb/292491

请参阅http://support.microsoft.com/kb/292491

there: For testing purposes, developers can force a specific version of an Office application to register by using the /regserver switch on the command line. For example, to force an Excel version to register without running setup, you can use a command line that resembles the following:

存在:出于测试目的,开发人员可以使用命令行上的/ regserver开关强制特定版本的Office应用程序进行注册。例如,要强制Excel版本注册而不运行安装程序,您可以使用类似于以下内容的命令行:

"c:\program files\microsoft office\office\excel.exe" /regserver

“c:\ program files \ microsoft office \ office \ excel.exe”/ regserver

#1


2  

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.

我有类似的经历,我正在运行Office 2010,我想在Office 2003之前使用Office代理。所以我在我的盒子上安装了Excel 2003,但我没有工作。

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

我找到了这篇文章并尝试了所有选项。 reaseaching我发现我应该使用:

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

for office 2003 but it didnt work.

办公室2003年,但它没有工作。

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

我的所有测试都是在VBSedit软件中完成的,该软件显示它使用的是Office 2003,但它实际上是在2007年开放。

I tried with primalscript and is working like a charm.

我尝试过primalscript,并且像魅力一样工作。

I think this might help others.

我认为这可能有助于其他人。

#2


1  

Try:

尝试:

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

设置myApp = CreateObject(“Excel.Application.12”)

#3


1  

see http://support.microsoft.com/kb/292491

请参阅http://support.microsoft.com/kb/292491

there: For testing purposes, developers can force a specific version of an Office application to register by using the /regserver switch on the command line. For example, to force an Excel version to register without running setup, you can use a command line that resembles the following:

存在:出于测试目的,开发人员可以使用命令行上的/ regserver开关强制特定版本的Office应用程序进行注册。例如,要强制Excel版本注册而不运行安装程序,您可以使用类似于以下内容的命令行:

"c:\program files\microsoft office\office\excel.exe" /regserver

“c:\ program files \ microsoft office \ office \ excel.exe”/ regserver