ooper

Using this vbscript in an ASP page in an attempt to figure out how to not create a new instance of Excel each time the ASP page is called.

dim excelApp

set excelApp = Server.GetObject(,"Excel.Application")
if (err <> 0) then
set excelApp = Server.CreateObject("Excel.Application")
end if
excelApp.UserControl = True
excelApp.Visible = True
excelApp = nothing


But the above code always creates a new instance. The Server.GetObject never attaches to the existing instance. It errors out with the following error:

Error - Number:429 Source:Microsoft VBScript runtime error Line:180 Description:ActiveX component can't create object

Why

Have tried everything I can think of and everything I have found online while researching this. Any ideas

Running Excel 2003 on IIS 6 and Windows Server 2003.

Thanks,
Brian Barnett


Re: Visual Studio Tools for Office New instance of Excel opens when it should not

Cindy Meister

Hi Brian

This newsgroup is specifically for questions about the VSTO technology and doesn't cover general Office automation questions. Since asp is not even remotely VSTO-related (it's not even .NET), I'm afraid you're way off-topic, here :-)

You are aware that Office applications are NOT supposed to be run in a server environment

Considerations for server-side Automation of Office
http://support.microsoft.com/kb/257757/en-us

You could also be running into security issues on your server. I think your best bet would be to ask in a newsgroup related to scripting. Maybe start here

http://msdn.microsoft.com/newsgroups/default.aspx dg=microsoft.public.scripting.vbscript&lang=en&cr=US