简体   繁体   中英

Unknown runtime error: 'Workbooks.Add' (800a03ec)

I have recently inherited a Classic ASP which, among other things, makes use of Excel office automation to dynamically build an Excel file which is then offered as a download to the user.

The website has recently been moved onto a new Windows Server 2012 R2 server, where it operated without issue until around 2 weeks ago.

I have spoken to the infrastructure team, and they reported that a number of Windows Updates were applied (including Office 2010 SP2), around the same time when the website issues were reported.

I have isolated the asp vbscript (see below), which I can use to recreate the error:

<%

Dim xlapp, WB
Const xlWorkSheet = -4167 

Set xlapp = Server.CreateObject("Excel.Application")
xlapp.ScreenUpdating = False
Set WB = xlapp.Workbooks.Add(xlWorksheet)

%>

The specific error I receive is:

Microsoft VBScript runtime error '800a03ec'

Unknown runtime error: 'Workbooks.Add'

/Test.asp, line 8

I realise that Office automation is not a recommended approach by Microsoft, but in the mean time, I wondered if the community could assist with this error as I've been reading countless blog posts with potential fixes, none of which have worked. For information, I have also had the infrastructure team repair the Office installation as well as reboot the server.

try changing

Set WB = xlapp.Workbooks.Add(xlWorksheet)

to

Set WB = xlapp.Workbooks.Add()

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