简体   繁体   中英

Vbs on Excel Starter 2010: activex component can't create object Excel.Application

I have a new pc with Windows 7 and Office Starter 2010 pre-installed. If I launch the following simple vb script (from command line: cscript testScript.vbs):

Dim xlApp
Set xlApp = CreateObject("Excel.application")
xlApp.visible = True
Set xlWorkbooks = xlApp.Workbooks
Set xlWorkbook = xlWorkbooks.Open("C:\path\myFile.xls")
xlWorkbook.ActiveSheet.Rows("1:2").AutoFit
xlApp.visible = False
xlWorkbook.Save
xlWorkbook.Close("C:\path\myFile.xls")
xlApp.Quit
Set xlApp = Nothing

it returns this error: activex component can't create object 'Excel.Application' . I don't understand if the error is due to Starter limitations ( http://office.microsoft.com/en-us/starter-help/excel-features-that-are-not-fully-supported-in-excel-starter-HA010374501.aspx ), and I found dissenting opinions on the web.

Is there a way to make it works using Office Starter version?

Despite this is already very aged question, I haved decided to post the following information only to help other googlers.

Since you are trying to create an instance of Excel.Application outside VBA, there's a good chance of being succeeded if you install an updated version of Microsoft Excel Viewer on target machine. This will allow you to access Excel's API .

Bear in mind, that Excel Starter Edition does not support macros, along with other important limitations .

Cheers!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM