473,549 Members | 2,408 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error opening Excel 2000 file after C# has used the file

Hi,
I'm opening and closing an excel using C#. Once the file has been opened and
closed I then double click on the file with Windows Explorer and excel opens
and then just hangs.
Can anyone help?
Thanks
Garth
ga************* @cpt.softwarefu tures.com
Below is the platform and source code that I'm using.

My platform:
Excel 2000
..Net 2003
Windows 2000 Server

Source Code:
(Note I've made a COM reference to the Excel 9.0 Object Library)
private void openFile()
{
//Open the application
app = new Excel.Applicati onClass();

wbook = app.Workbooks.O pen("c:\\Book1. xls", System.Reflecti on.Missing.Valu e,
System.Reflecti on.Missing.Valu e, System.Reflecti on.Missing.Valu e,
System.Reflecti on.Missing.Valu e, System.Reflecti on.Missing.Valu e,
System.Reflecti on.Missing.Valu e, System.Reflecti on.Missing.Valu e,
System.Reflecti on.Missing.Valu e, System.Reflecti on.Missing.Valu e,
System.Reflecti on.Missing.Valu e, System.Reflecti on.Missing.Valu e,
System.Reflecti on.Missing.Valu e);

app.Visible = true;
}

private void closeFile()
{
//Close the Application:
wbook.Close(Sys tem.Reflection. Missing.Value,
System.Reflecti on.Missing.Valu e, System.Reflecti on.Missing.Valu e);

app.Workbooks.C lose();

app.Quit();

System.Runtime. InteropServices .Marshal.Releas eComObject(wboo k);

System.Runtime. InteropServices .Marshal.Releas eComObject(app) ;

//aSheet = null;

wbook = null;

app = null;

GC.Collect();

}
Nov 16 '05 #1
0 1447

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

Similar topics

1
5019
by: Wayno | last post by:
My php logs are coming up empty. I have done all I can think of, and all that made sense to me. Can someone take a look at my php.ini please and tell me what you think may be the problem. I double-checked the path to my error log. It is in /var/www/logs/php_error_log Thanks. :) -Wayne Stevenson
6
4721
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much appreciated. Thanks in advance
4
2071
by: Mark | last post by:
Hello - I receive the error message: System.Runtime.InteropServices.COMException: The remote procedure call failed. when I open an Excel file using from an ASP.Net page. Imports Microsoft.Office.Interop Imports System.Runtime.InteropServices.Marshal Public Sub LoadData()
1
3695
by: Bon | last post by:
Hello all I create a form with three buttons in MS Access 2000. They are Open Excel Template, Save Draft and Save Final. When I click the Open Excel Template button, the Excel template will be opened. Inside the Excel template, I have assigned a draft watermark to the Print icon. When the Print icon is clicked, the draft watermark and print...
2
3111
by: Mad Scientist Jr | last post by:
>From an asp.net web page I want the user to open the results of a SQL query in Excel, as automatically as possible (ie not having to loop through columns, rows, in code). For this, dataset.writexml works great (got the code from http://forums.devx.com/archive/index.php/t-57273.html ) The only question I have is, when Excel opens up, it...
29
23141
by: aarthi28 | last post by:
Hi, I have written this code, and at the end, I am trying to write a vector of strings into a text file. However, my program is nor compiling, and it gives me the following error when I try to write to the file: error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable...
1
6165
by: mohanprasadgutta | last post by:
Hi, I need help to open a password protected excel file in perl using Win32:OLE. when I tried to open file in normal way at the time of program execution it is prompting me to enter password. I am giving the script i used for opening excel file.. So i want to know how to provide password parameter while opening the file. use strict; use...
1
1031
by: Ahmd | last post by:
Error: - the process cannot access the file. XXXXX.xls becuase it is being used by another process. I used OLE DB for opening EXCEL File ; - ' Connect to the Excel Spreadsheet Dim xConnStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & Server.MapPath("~/ ExcelImportPayOut.xls") & ";" & _ "Extended Properties=Excel...
5
5864
geolemon
by: geolemon | last post by:
Import text wizard says: I'm banging my head on this one, here's why: I've been importing files using this process and data format, with success! I created a temporary table in Access to facilitate my import process (It's all text columns, I perform transformations later). And I created a template in Excel to correspond to the table -...
0
7542
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7467
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7736
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. ...
1
7500
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...
0
7827
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...
1
5385
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5110
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...
1
1961
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
0
783
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...

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.