|
-
January 30th, 2003, 02:02 PM
#1
closing excel application
Hi all,
How do i close xlapplication. I try to use
dim xlApp as new excel.application
xlapp.quit
but the process seems to be hanging there until i quit from my app.
also how do i make it visible in .NET. In vb 6 it was just
xlApp.Visible = true it does not work with .Net
Thanks
-
January 31st, 2003, 12:54 PM
#2
after you quit excel
xlapp.quit
you have to set object to nothing
xlapp = Nothing
That will kill the excel app
-
February 3rd, 2003, 04:48 AM
#3
i've tryed it, doesn't work. it is still three event after i quit my app.
i have to create large number of xlapps and at the end they all there hanging...
-
February 6th, 2003, 05:01 PM
#4
Is there a component that I need to add to be able to issue the command:
dim xlApp as new excel.application
If I try this it is an error, because excel.application is not defined. Any thoughts?
-
February 8th, 2003, 03:05 PM
#5
you need to add reference / project/add reference/com/ microsoft excel ....
-
February 8th, 2003, 04:46 PM
#6
You may want to try getting the new COM objects from microsoft that are for office. This may help...
-
February 8th, 2003, 05:49 PM
#7
Are they not meant to come with office you install. I'm using office 2000 but tried office xp. the same problem.
Does it work for you? if you check task manager before closing your application.
I start to think that this is ms **** automatic garbage collector problem.
-
February 9th, 2003, 11:29 AM
#8
You can prevent Excel hanging around by explicitly cleaning up any Excel
objects you instantiated with Marshal.ReleaseComObject and then invoking the
..NET garbage collecter before exiting.
Something like:
While (Marshal.ReleaseComObject(m_excelObj) <> 0) ' Repeat until no
more COM references
End While
m_excelObj = nothing
..... repeat for any other Excel objects allocated
' Invoke garbage collector before termination
GC.Collect()
GC.WaitForPendingFinalizers()
-
February 9th, 2003, 12:24 PM
#9
Thanks Iouri, it worked for excel,
now the same doesnot work for outlook. also if i try to quit outlook from olapp.quit i get
'Quit' is ambiguous across the inherited interfaces 'Outlook._Application' and 'Outlook.ApplicationEvents_Event'.
-
February 12th, 2003, 11:04 AM
#10
When I use that code to close out my Excel Appliction, it seam so work fine. byut when I try to open up the file I created, somtimes it opens up excel, but I can't veiw the cells. I can only see the toolbars, and where the cells should be I can see my desktop. Also any thoughts on how to caclulate 2 cells, and put the total in a different cell. And formating a cell, so it is a percentage, stuff liek that.
-
February 12th, 2003, 11:16 AM
#11
Funny you mentioned that you can see your desktop because just yesterday when I attempted to open an excel spreadsheet, it did the same thing - no matter which worksheet.
Fix: make sure that excel.exe is not running in your processes in Task Manager. If it is, end the process and try opening your spreadsheet again. That should fix that problem.
-
February 12th, 2003, 12:35 PM
#12
With VB.NET what code would I use to chage the Fill Color of a cell, Freeze Panes, calculate cells, and add borders? Is their a good web site for any of this? Gknierim, I closed the Excel.EXE and it worked fine. What had happed is that I gave an invaild file name to SaveAS, so the program never got all the way through closing Excel. Thanks.
BJG
-
February 12th, 2003, 01:03 PM
#13
In my Task Manager..why won't my Excel.EXE close until I close stop running my VB project.
-
February 12th, 2003, 01:31 PM
#14
I think that you could use the following to get you started. These are just a few:
Code:
Dim oSheet as Excel.WorkSheet
'For a border - specify start and end for range
oSheet.Range("A1", "D12").BorderAround()
'For bold etc..
oSheet.Range("A1", "D12").Font.Bold = True
Look at the range property in your help for the Excel object and it will give you several examples on how to format your cells.
HTH,
Greg
-
February 12th, 2003, 01:36 PM
#15
Here is my code for creating and closing Excle through VB.NET. If I close or exit my VB Applictaion I can use excel fine, and EXCEL.exe is deleted from my Task Manager. What I want to do is be able to use excel while my VB Application is still running. So how do I get that EXCEL.exe to be end from Task Manager.
Dim xlapp As New Excel.Application()
xlapp.Workbooks.Add()
''' Do a bunch of random things here(adding totals, writing to cells, etc.)
xlapp.Workbooks(1).Close(False)
xlapp.Quit()
While(System.Runtime.InteropServices.Marshal.ReleaseComObject(xlapp) <> 0) ' Repeat until no more COM references
End While
xlapp = Nothing
' Invoke garbage collector before termination
GC.Collect()
GC.WaitForPendingFinalizers()
PLEASE HELP!
BJG
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|