473,797 Members | 3,166 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error Message Saving Excel Workbook

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.Applicati on()
Dim oBooks As Excel.Workbooks
Dim oBook As Excel.Workbook

oExcel.Visible = True
oExcel.DisplayA lerts = False

'Start a new workbook
oBooks = oExcel.Workbook s
oBooks.Open("c: \test.xls", 0)
oBook = oBooks.Item("te st.xls")
:
:
oBook.SaveAs(sT emplate) '**** Occurs Here *****

oBook.Close()
Suggestions/workarounds?

Thanks, Mark
Dec 2 '05 #1
1 2039
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.
"Mark" <Ma**@discussio ns.microsoft.co m> wrote in message
news:25******** *************** ***********@mic rosoft.com...
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.Applicati on()
Dim oBooks As Excel.Workbooks
Dim oBook As Excel.Workbook

oExcel.Visible = True
oExcel.DisplayA lerts = False

'Start a new workbook
oBooks = oExcel.Workbook s
oBooks.Open("c: \test.xls", 0)
oBook = oBooks.Item("te st.xls")
:
:
oBook.SaveAs(sT emplate) '**** Occurs Here *****

oBook.Close()
Suggestions/workarounds?

Thanks, Mark
Dec 3 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
808
by: Jimmer | last post by:
I've got what should be an easy automation problem, but the solution simply isn't coming to me. I've got several public variables set up for automation as follows: Public gappExcel As Excel.Application 'ADO Object for Excel Automation Public gstrExcelDir As String 'Source or Destination Directory
4
8466
by: IMS.Rushikesh | last post by:
Hi All, I am trying to execute below code but it gives me an COMException ///// Code Start //// public string GetName(Excel.Range range) { try { if (range.Name != null)
6
410
by: Rich Wallace | last post by:
Hi all, I have a VB app that runs and manages individual XLS files within a single COM object. Upon processing the final fie, I attempt to close out the EXCEL object and release it using System.Runtime.InteropServices.Marshal.ReleaseComObject. I have a Try...Catch in my routine as seen below and when I receive the error, my Catch is never called so my app sees the release as successful, but when I look in Task Manager, the EXCEL.EXE...
1
1548
by: Mark | last post by:
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
0
3244
by: zfraile | last post by:
I'm getting this error from the JIT compiler at runtime, but only on my boss' machine, not my development machine. I believe the error is generated from a call to an Excel object, but I can't tell why or what specific action on the object is causing it. We both are running version 2.0 of the .net framework with Office 2003 installed, though I am running XP and she has Win2000. Also, I do not get this error when running another sub in...
0
3008
by: Anish G | last post by:
Hi All, I am getting the below given error while running my application in live server. In my local machine, its working fine. Please help me as it is very urgent for me. Exception from HRESULT: 0x800A03EC Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details:...
6
3369
by: Karl | last post by:
Hi all, It may seem like a rather odd request (or not) but I would like to be able to create a file (doc, jpg, xls or one of many other files that can be automated) on a website and stream it to a user without saving it to the disk first. Obviously saving the file first and streaming it afterwards is fairly easy to do, but it relies on disk write permissions on the server and you'd have to make sure the file was removed afterwards.
0
1753
by: dprjessie | last post by:
Hello, I am a Web programmer and I'm working on my first desktop application as a favor for a friend. I'm sure I have a stupid error here, but there is no error being thrown so I can't figure out what is wrong. I have code that reads an excel file and fills a datagridview and it works just fine. It is also supposed to fill a database though and that is not working. The executeNonQuery command is returning a 1 which as I understand, means it has...
10
25759
by: N2Deep | last post by:
I have a macro that does a few things to an Excel workbook and then saves, and closes to an Excel workbook. I now want to save, close the Excel workbook as a text (tab delimited .txt) file. Currently I am closing/saving the file near the end of my Sub with: wbResults.Close SaveChanges:=True Dim wbResults As Workbook...at the beggining of my sub. I've tried many things and can't seem to make the change or get it to work.
0
10469
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10246
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10209
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10023
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6803
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4135
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3750
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2934
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.