Excel hang when SaveAs

C

cct

Dear all,

My environment:-
Windows Server 2003
Office XP with SP3
dotnet 1.1 with SP1
ASP.net with VB Com dll.

The following code (in VB com dll) is working fine when Excel file is
without Macros :-

Set xlApp1 = New Excel.Application
xlApp1.EnableEvents = False
Set xlWBook = xlApp1.Workbooks.Open(sourcefile, False, , , Passwd)
xlApp1.EnableEvents = True

Dim filename As String
filename = "ABC.xls"

On Error Resume Next
Kill filename

Method #1:-
xlWBook.SaveAs filename, , "" --> No error, Excel hang in Task Manager

Method #2:-
xlApp1.EnableEvents = False
xlApp1.DisplayAlerts = False
xlWBook.SaveAs filename, , "" --> Error! Document not saved.

If I manually open the excel file through Excel Application, I am able to
save as another file without error.

Does anyone know how to fix this.
Thanks in advance.
 
P

Peter Huang [MSFT]

Hi

Are you automation Excel in the Server side, i.e. in the ASP.NET code?
We did not recommend automation Office Product in serverside because office
product is designed for desktop interactive operation.
Here is a KB article for your reference.

This article discusses the complications that developers may face, offers
alternatives to Automation that can speed performance, and suggests ways to
configure Office if server-side Automation is unavoidable. Developers
should be aware, however, that the suggestions provided below are for
informational purposes only. Microsoft does not recommend or support
server-side Automation of Office.

NOTE: In this context, the term "server-side" also applies to code that is
running on a Microsoft Windows NT or Microsoft Windows 2000 workstation,
provided that it is running from a WinStation other than the interactive
station of the user that is logged on. For example, code that is started by
Task Scheduler under the SYSTEM account runs in the same environment as
"server-side" ASP or DCOM code, and therefore experiences many of the same
issues. For more information on WinStations and COM, see the "More
Information" and "References" sections.

INFO: Considerations for Server-Side Automation of Office
http://support.microsoft.com/default.aspx?scid=kb;en-us;257757


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top