Error Message Saving Excel Workbook

G

Guest

Hello -

I'm opening/saving an Excel workbook from ASP.Net. When I try to save the
workbook I get the error:
System.Runtime.InteropServices.COMException: The remote procedure call failed.

Code:
Dim oExcel As New Excel.Application()
Dim oBooks As Excel.Workbooks
Dim oBook As Excel.Workbook

oExcel.Visible = True
oExcel.DisplayAlerts = False

'Start a new workbook
oBooks = oExcel.Workbooks
oBooks.Open("c:\test.xls", 0)
oBook = oBooks.Item("test.xls")
:
:
oBook.SaveAs(sTemplate) '**** Occurs Here *****

oBook.Close()


Suggestions/workarounds?

Thanks, Mark
 
D

David Lloyd

Mark:

Can't tell for sure from your code, but did you set the value for the
sTemplate variable? If this value isn't set it can cause a COMException.
If it is set, you may want to show more of the code.

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


Hello -

I'm opening/saving an Excel workbook from ASP.Net. When I try to save the
workbook I get the error:
System.Runtime.InteropServices.COMException: The remote procedure call
failed.

Code:
Dim oExcel As New Excel.Application()
Dim oBooks As Excel.Workbooks
Dim oBook As Excel.Workbook

oExcel.Visible = True
oExcel.DisplayAlerts = False

'Start a new workbook
oBooks = oExcel.Workbooks
oBooks.Open("c:\test.xls", 0)
oBook = oBooks.Item("test.xls")
:
:
oBook.SaveAs(sTemplate) '**** Occurs Here *****

oBook.Close()


Suggestions/workarounds?

Thanks, Mark
 

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

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top