473,795 Members | 3,439 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to force ExcellApp.Quit( ) when it's actually called?

Hi,

I load the contents of an excel sheet into a dataset via the excel
object library (couldn't get the #$%#$^ oledb/ado route to work -
#^$%&^%$ connection strings... grrr.... )

Anyway, after I get the sheet's contents into my dataset, I'd love to
jettison excel. Calling ExcelApp.Quit() has no effect until I exit the
entire application. How can I force excelapp.quit() to take effect when
the line is executed?

thanks!

cdj

Oct 26 '06 #1
4 2188
Hi cdj,

Are you operating Excel through Late Binding?

I had similar issues to the ones you describe and found that Marshall.Releas eComObject did the trick.

Hope it helps

Stuart King
Informology Ltd.

"sherifffruitfl y" <sh************ *@gmail.comwrot e in message news:11******** **************@ m73g2000cwd.goo glegroups.com.. .
Hi,

I load the contents of an excel sheet into a dataset via the excel
object library (couldn't get the #$%#$^ oledb/ado route to work -
#^$%&^%$ connection strings... grrr.... )

Anyway, after I get the sheet's contents into my dataset, I'd love to
jettison excel. Calling ExcelApp.Quit() has no effect until I exit the
entire application. How can I force excelapp.quit() to take effect when
the line is executed?

thanks!

cdj
Oct 26 '06 #2

Stuart King wrote:
Hi cdj,

Are you operating Excel through Late Binding?
Hi Stuart -

Thanks for the reply.

My project's references to the Excel 11.0 object library are added
before I compile - I take it that's a "no" to your question?

Oct 26 '06 #3
Hi cdj,

I've tried the approach I gave you using the Microsoft Office
references(Earl y Binding) and in fact it still gives the desired effect. I
tried it out in a button click handler on a form. The following code does
nothing fancy, all it does is show Excel, waits for 5 seconds then quits
Excel again. If you use Task Manager you should be able to see the excel
process coming alve and then being unloaded from memory

private void button1_Click(o bject sender, EventArgs e)

{

Microsoft.Offic e.Interop.Excel .ApplicationCla ss App = new
Microsoft.Offic e.Interop.Excel .ApplicationCla ss();

App.Visible = true;

System.Threadin g.Thread.Sleep( 5000);

App.Quit();

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

}

Hope this helps.

Stuart King

Informology Ltd.

"sherifffruitfl y" <sh************ *@gmail.comwrot e in message
news:11******** **************@ f16g2000cwb.goo glegroups.com.. .
>
Stuart King wrote:
>Hi cdj,

Are you operating Excel through Late Binding?

Hi Stuart -

Thanks for the reply.

My project's references to the Excel 11.0 object library are added
before I compile - I take it that's a "no" to your question?

Oct 27 '06 #4

Stuart King wrote:
System.Runtime. InteropServices .Marshal.Releas eComObject(App) ;
That line (which I didn't understand the first time you mentioned it)
solved all problems.

Thanks a million!

cdj

Oct 31 '06 #5

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

Similar topics

27
5092
by: Curious Angel | last post by:
I have a resume in PDF format and I want anyone who LEFT-OR-RIGHT clicks the link to force the file to be saved, and in any event _not_ opened. Since the PDF will be in his cache in any event, I would just as soon place the employer in control of what directory he wishes to save it in, and there are two salient reasons for this: 1. I want him to OWN the document 2. I want him to FIND the document, quickly, on his hard drive In any...
4
2464
by: Lauren Quantrell | last post by:
If an Access2K ade is running, say it's named app1.ade, and I open app2.ade, I want app2.ade to determine if app1.ade is running, and if it is, I want app2.ade to close app1.ade. Is this easy? lq
0
1130
by: lauren quantrell | last post by:
In Access, is there a simple way to determine if another Access application is running and then force it to quit? Example App1 is running. It checks to see if App2 is running. If App2 is running, App1 runs a command to close App2. Thanks, lq
1
2453
by: palouf | last post by:
Hi everybody. I try to build some Outlook 2000 / XP Addin, It works fine with the XP version, but with OL 2k, nothing to do, it never quits outlook (i can see it in the process list) I read in a microsoft article that this could happen when all the Com_object instances are not set to null. This is what i have done ((or seems to)) but it doesn't quit too. So my questions are following : 1 . is there a way to see in one round alla the...
6
5300
by: Max | last post by:
I have the following code on a form that launches Microsoft Outlook and creates a new email message for the user: Outlook.Application oApp = new Outlook.Application(); Outlook.MailItem oMail = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem); oMail.HTMLBody = "SOME HTML TEXT HERE"; oMail.Display(oApp); oMail.Close(Outlook.OlInspectorClose.olDiscard);
8
16546
by: Keith H | last post by:
I'm looking for a way to force the user to re-authenticate with their Windows username/password/domain after clicking the submit button on an ASP.NET page. This is for an internal application. Does anyone know if/how this can be done?
2
11453
by: Alan T | last post by:
private Interop.Word.Application _wordApp; What is the differences betwenn _wordApp.Quit(...) and _wordApp.Application.Quit(...) ?
3
4283
by: Andy_Khosravi | last post by:
I have a method in place in my application to force users out. It's a simple tactic I got from these newsgroups where you create a table with one record called logout, then check that field with a timer on a form that doesn't close. If it's checked, it starts a forced logout sequence. Works fine 99% of the time (unless somebody is in the middle of a record update and walks away from their computer for several hours, but that's a...
2
2693
by: tovishal2001 | last post by:
Hi, I am trying to read first 6000 bytes from a webpage, using StreamReader.Read(buffer, offset, no_of_bytes_to_read) method and trying to close the connection. Because, the useful data I need is present in the first 6000 bytes of the webpage and webpage size is atleast 100Kb. And, I need to repeat this operation for around 100s of such pages. Thats why I would close the connection after I am done reading initial 6000 bytes. Now the...
0
9672
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10437
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
10214
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
10164
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
10001
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
6780
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
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3723
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.