473,387 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

OLE: Excel.Application

Hello,

in VB.Net, I use Excel to display results :

dim xl as new Excel.Application // creates an Excel process
// snip (putting values into cells)
xl.Visible = true

If the user closes the Excel file, the Excel process remains
in memory until my program is closed, which is good.

If the user closes my program first and then the Excel file,
the Excel process remains in memory !

How can I make sure the process will be killed ?

Thanks !


Aug 10 '06 #1
1 1915
Hello, myname,

You need to include a line like:

xl.Quit

in the appropriate place. But due to the vagaries of .Net garbage
collection this may not result in immediate termination of the Excel
application. For this you could add lines like:

System.Runtime.InteropServices.Marshal.ReleaseComO bject(...)
. . .
System.Runtime.InteropServices.Marshal.ReleaseComO bject(xl)
GC.Collect()
GC.WaitForPendingFinalizers()

where "..." refers to any Excel Workbook and Worksheet objects that you
have opened.

Cheers,
Randy
myname wrote:
Hello,

in VB.Net, I use Excel to display results :

dim xl as new Excel.Application // creates an Excel process
// snip (putting values into cells)
xl.Visible = true

If the user closes the Excel file, the Excel process remains
in memory until my program is closed, which is good.

If the user closes my program first and then the Excel file,
the Excel process remains in memory !

How can I make sure the process will be killed ?

Thanks !

Aug 11 '06 #2

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

Similar topics

1
by: M. David Allen | last post by:
Hello, I've been using ActiveState's ActivePerl to generate Excel spreadsheets using the Win32::OLE module. The rudimentary examples that are out there on the web show the way to set up...
0
by: VIvek Thakur | last post by:
Hell I m making a C# windows application which connects to excel to retrieve live data( stock quotes which are feeded to this excel sheet from other program via internet). The data in excel sheet...
9
by: Avi Nahir | last post by:
Hi all, I'm developing a C# .Net Windows Forms application, and am trying to "host" mshtml. Observing ItWriting control (http://www.itwriting.com/htmleditor/index.php), I saw it implements...
3
by: sandycat05 | last post by:
Hello all, I am a new Perl programmer. Below is the beginnings of a code that I am using to manipulate an Excel spreadsheet via Perl using win32::OLE. However, what I'd like to do is the following:...
0
by: zhang | last post by:
I have a project to embed Excel in VB application using OLE. However, when running this application, I found that I can't put Formula Bar on EXCEL. Is there any way to open EXCEL on Emdeded OLE as...
6
by: Rasputin | last post by:
Hello, I am new to this forum, but the activity I have noticed reading the posts helps me believe this is a good spot for wannabes programmer like me. I am also fairly new working under a...
8
by: rssd | last post by:
can somebody help me. I'm trying to read some excel files but i'm always getting this error No type library matching "Microsoft Excel" found at D:\Genes_datasets\exp.pl line 4 Win32::OLE(0.16):...
1
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...
6
by: poolboi | last post by:
hi all, i've got the following program that needs yr help: use Win32::OLE; # use existing instance if Excel is already running eval {$ex =...
1
by: user1357 | last post by:
Hi all, i am trying to run the following code use strict; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel';
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...

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.