how to close an application using automation

Hi 
I am  writing an application using VB.NET and office 2003.
I write some data into the Excel sheetand tehn close it 
but, I can still see teh excel.exe running in the task 
manager. .Please help me...:((

The code I am using is :

Dim Excel As New Excel.ApplicationClass 
 ' Get a new workbook
Dim oBook As Excel._Workbook = CType
(Excel.Workbooks.Add(oTemplate), Excel._Workbook)
.....
....
oBook.SaveAs("c:\SearchResults.xls")
Excel.ActiveWorkbook.Close(False)
                
System.Runtime.InteropServices.Marshal.ReleaseComObject
(oBook) ' releases the workbook object
oBook = Nothing
Excel.Quit()
             
System.Runtime.InteropServices.Marshal.ReleaseComObject
(Excel)  ' releases the excel object
Excel = Nothing

Thanks a lot..
Vishal
0
anonymous (74722)
1/5/2004 11:52:16 AM
excel.misc 78881 articles. 5 followers. Follow

0 Replies
356 Views

Similar Articles

[PageSpeed] 16

Reply:

Similar Artilces:

ThisWorkbook.Close question
Please take a look at the code below: Public Sub DumbFoo ( ) ThisWorkbook.Close() Sheet1.Range("A1").Value = -1 ThisWorkbook.Save() End Sub Is it safe to assume that the code below the "ThisWorkbook.Close()" line will NOT be executed??? My question is basically: Does all VBA code stop executing once a .Close() function is called??? Thank you! I don't believe the code would execute at all because of the parentheses after Close. It would throw an error an tell you that something is missing, or type mismatch. But, if you did...

Using Outlook for reading newsgroups...
How do you use Outlook to read newsgroups? For some reason I can only read them with Outlook Express. Thanks Ben "Ben Fidge" <ben.fidge@btopenworld.com> wrote in message news:uqnKScYoEHA.3988@tk2msftngp13.phx.gbl... > How do you use Outlook to read newsgroups? For some reason I can only read > them with Outlook Express. > > Thanks > > Ben > > That's correct. Outlook doesn't "do" newsgroups. OE does. > -----Original Message----- > From: Ben Fidge [mailto:ben.fidge@btopenworld.com] > Posted At: 23 September 2004 16:59 ...

How to Enable Close(cross) button of MB_YESNO messagebox
Hi, I want to enable the close(cross) button in the right corner of YESNO message box. Can anybody tell me how to do this. Klic. "Klic" <rohit.turambekar@gmail.com> wrote in message news:1186120969.045121.287770@i13g2000prf.googlegroups.com... > I want to enable the close(cross) button in the right corner of YESNO > message box. > Can anybody tell me how to do this. Why? If there is a valid answer other than yes or no, then how about a yes/no/cancel message box in which (I would guess) the x button is equivalent to cancel. That would be more standard. Da...

Outlook closes and closes
Hi I have a strange bug. Windows XP Sp2 and outlook from office 20003 with all service packs applied. When I start outlook from windows out of standby postion, outlook immediately after the splash screen closes without reporting any errors in the eventlog or in any other log. If I start outlook the 10th time (or so) it stabilizes and does not close anymore and everything works again. info: My machine is fully patched and I am well known with keeping things healthy. Outlook.exe Version: 11.0.6353.0 Any ideas what to do? Thanks... try the detect and repair in the help menu. >----...

closing
What's the best way to close for the day? Making a backup is a given, but what about the computer? Is it better to shut everything off every day, or is it less wear and tear on the computer to leave it on all the time? Any thoughts on this would be appreciated. Craig That's a matter of preference really. Personally I always turn off my rigs at home when I'm done with them. At the store we leave most of ours on 24/7. We've done it for years with no issues. Our register must be left on as it does automatic backups to a tape drive every night. I'd set your monitors ...

Help
When creating or fowarding an e-mail message using outlook 2000, scrolling through my "recipients" list (contacts) causes the program to close unexpectedly. So, I click "new", click "to", switch to my "contacts" list, and as I scroll through the names, the program just closes. Is there a possibility that one of my contact records is corrupt? I have opened all of my contacts and saved them without an error. This problem developed shortly after the install of Office 2000's calender update, and basic security update. I have since fully u...

Use of CLIPBOARD in EXCEL
Why do items put on to the CLIPBOARD in EXCEL disappear the moment ypu type something in a cell? Is there any way of disabling this very annoying feature? If you're using Excel 2002, or later version, you can use the Office Clipboard, which stores more items. To see it, choose Edit>Office Clipboard. alandwebb wrote: > Why do items put on to the CLIPBOARD in EXCEL disappear the moment ypu type > something in a cell? Is there any way of disabling this very annoying feature? -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html ...

Deserializing an Object from XML Using Schema
Hi, I need to deserialize an existing object (not generate its code) from a serialized XML file. The only information I have about how the deserialization method is an input XML schema (which can vary) associated with the XML file containing the serialized object data. Therefore pre-defining it in code using xml attributes on the serialized class narrows it to only one serialization method and won't do. How can I use the schema to deserialize the object? Thanks, Sigalit. "Veilchen" <Veilchen@discussions.microsoft.com> wrote in message news:A71F15AB-7D2C-4E50-97DB-...

Workflow Rule -> Closing Activity
I set up a Manual Workflow Rule for Contacts to close out Holiday Season cards sent. The rule uses a condition to check for Contacts with cards sent and then Creates an Activity to add to each of the appropriate Contacts for future reference. What else do I need to do to close out all of activites rather than 1 at a time? Here is the workflow rule if that helps: if Contact.holidaycardlist = 1 then Letter: Send Holiday Card endif -- Dan W Systems Engineer Denver, CO ...

Auto-close Quotes when Closing Opportunity
We would like the ability to close an opportunity and have it ask if you want to close all the associated quotes. Right now, it says you can’t close the opp until you close all the open quotes and you have to each one of those one by one. Barring that, if we could select multiple quotes and click on a menu item (Close all selected quotes), that would be most useful. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not ...

Returning a value from another application
I am calling an Excel module from Access and would like to know if the Excel module produces a certain result (Warning = True). How do i return the value of the variable warning from the excel module to Access Code in Access Module Private Sub Cmd1_Click() Dim XL As Object Dim fName As String Set XL = CreateObject("Excel.Application") XL.Visible = False fName = "C:\Documents and Settings\595930.CORP\My Documents\SDI\Andy\Sample Dirt Template 1-4-07.xls" XL.Workbooks.Open fName XL.Run "Validation.Validation" XL.ActiveWorkbook.Close XL.Quit Set XL = Nothing En...

How to initialize a multidoc application without a document?
The program is developed under Visual C++ 6.0. The program is the multiple-document application. I would like the program to start without opening a document. How to realize? Use CCommandLineInfo::FileNothing in your app's initinstance. Something like this: // This all goes in CMyApp::InitInstance CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew) cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing; if (!ProcessShellCommand(cmdInfo)) return FALSE; --------- Ajay Kalra ajaykalra@yahoo.com ...

I do not want to use Outlook...so I uninstalled it.
I do not want to use Outlook...so I uninstalled it. BUT now I cant send mail from IE6 and my internet options, programs, does not allwo me to set my new default email progam to OE Also in my control panel, there is the listing MAIL, with OUTLOOK listed there. How do I get OUTLOOK completely off my computer?? ...

Email can't use my Contacts
When I click "TO" in email window, I get "The address list could not be displayed. The COntacts folder associated with this address list could not ne opened..." It then opens the "Select Names" dialog with no names listed. But in the "Show Names .." box there are 2 "Contacts" items listed; if I change to the second noe, I get my contatcs names, but next time I have to startover. Base on answer to post 174057 I tried to open the address book dialog but I got the same thing. I have configured this correctly in the past, but I just did a new Ou...

Data file not closed properly #3
I saw several post regarding this, but none had any answers, so I starting a new post. There is also nothing in the KB about this. Since othe people are having the same problem Microsoft should take a look at it. I get the message "The data file 'Personal Folders" was not closed properly" every time I close Outlook 2003. It runs a quick check/fix and starts up fine. I am running XP pro w/ SP-2. Outlook 2003 w/ SP-1 All patches and updates are current. My notebook was just rebuilt for so I could get a clean slate for the office 2003 install, (reformat drive and new ins...

CArchiveException When You Deserialize Classes in an MFC Application
Hello, I´m experiencing the same problem noted on Knowledge base article Q322621 from 10/16/2002 and it happens exactly in Visual Studio .Net 2003. Does anyone know of a workaround for this old problem? SYMPTOMS When you try to open a document, a CArhiveException exception is generated. In debug builds, you also receive the following trace message: CArchive exception: badClass. CAUSE Microsoft Foundation Classes (MFC) cannot dynamically create an object of a derived class during deserialization if you have a class in an MFC executable file with the following characteristics: The file...

AUTOMATE my CUSTOM REPORTS
PLEASE someone tell me how to have a custom report automatically. AND I DONT WANT SOME EXPENSIVE ADD-ON RESALERS!!!!!!!!! "PLEASE someone tell me how to have a custom report automatically..." Do what? Automatically get pushed to all stores? Automatically be available to all So Manager apps on your network? Or. Automatically download from the Reports Library? Rob "David Parrish" <david.parrish@vino100-lakeway.com> wrote in message news:e4oJNRzWGHA.3328@TK2MSFTNGP02.phx.gbl... > PLEASE someone tell me how to have a custom report automatically. AND I > D...

Do you need Access to use an Access Database for data entry only?
We have an Access database completed. Now we will use it for reading as well as for data entry. Do we need to install Access for every workstation needing the database for data entry or reading? No you don't necessarily need Access on every computer. You CAN use the Access Runtime and if it is in Access 2007 you can use it for free. If you are using another version then you would need to purchase the developer's edition to be able to legally distribute the associated Access runtime. If you do have 2007 and want to use the runtime, make sure your Full version of Access doe...

printing using avery paper
I am trying to print business cards on avery business card paper #8876. I cannot find a place to choose a specific avery paper so I did page set up and changed the vertical and horizontal gaps to zero and adjusted the card to its appropriate size. The problem i have run into is that as it prints my header gets closer and closer to the top edge of my cards. It shouldn't be a printer issue as the printer is brand new as of june 28th. Any suggestions? Free software that makes the production of business cards a breeze.. http://www.avery.com/us/Main?action=software.AverySoftwareDetai...

Outlook2003 open and closed immediatly
I checked event log, nothing. And this happened when I just reboot my machine and first time tried to open Outlook, still same problem. But I found, when I double click anywhere in the Outlook Windows even it only gave me 0.5 second, then it won't close. Andy -------------------------------------------------------------- >>Look in task manager - processes, and see if multiple >>instances are running. If so, end all of them and try >>starting again. I had similar problem w/user, posted >>above. >>>>>-----Original Message----- >>>>>My O...

Applications Responding Slowly on iMac with Intel
I just purchased the new iMac with the Intel processor. (I am also a new Mac user.) When I am using Microsoft Office, everything is responding slowly. For example, it can take 30-45 seconds to launch Excel. Also, when I'm executing certain actions within the applications, I sometimes get the "beachball" icon and everything is moving slowly overall. Applecare has no anwers for me, and I've taken the computer into the store for a diagnostic and everything came out clean with respect to my hardware. Has anyone else had this problem? You didn't specify, but I'm as...

Outlook Closes After Closing an Email
When I click the 'X' to close an email after reading it, Outlook closes (or tries to close, but I get a warning because I have templates in my Outbox). This only seems to happen when I close a new email. I have Outlook 2003. Thank you. ...

YE Closing Procedures
The year end closing procedures need to be more efficient and user friendly. For example, the payables and receivable management is date sensitive except for amounts since last close, vendor yearly summary etc. These modules should be fully date sensitive and the ability to enter into multiple years without caveats should exist. Year end is stressful enough ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the b...

Using clip-art in Excel
I'm trying to find a way to superimpose a washed-out, semi-tranparent clip-art object on top of a worksheet. Is that possible and if so, can someone share the process? Thanks! -- DAS "=?Utf-8?B?RGF2ZQ==?=" <Dave@discussions.microsoft.com> wrote in news:265B56EE-3567-42BB-90E1-205F90EBA11F@microsoft.com: > I'm trying to find a way to superimpose a washed-out, semi-tranparent > clip-art object on top of a worksheet. Is that possible and if so, can > someone share the process? > > Thanks! Insert/Picture/File? -- It is I, DeauDeau (Free after...

Permissions / Closing MDB left open
I need to learn how to create - well, I'm not actually sure what I need to learn... Let me explain: I'm a surgical resident. I've been working on an Access MDB as a patient census - for day-to-day management including tables, queries, and forms that print based on room number or service. Everything is setup as needed in the local file. I've been working on the content of the database on and off for a year. Recently, before I can implement my project, I realized I have a very big challenge to overcome related to usage of the file. Now, to complicate my iss...