Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hi,
in the following, there is a simple excel file open, write and close code. It works in my desktop computer very well, I mean it opens the file, writes something and close the file. but in my laptop, it doesn't close. It continues to appear in the task manager, in every time when I used the program, I have to close it in task manager or it will increase as I used the program mean there is 5,6,7...excel.exe program in the task manager. what should I do ? thank you. Dim XLSapp As Excel.Application Dim XLSbook As Excel.Workbook Dim XLSsheet As Object Private Sub Command1_Click() Set XLSapp = New Excel.Application Set XLSbook = XLSapp.Workbooks.Open("c:/test.xls") Set XLSsheet = XLSbook.Worksheets(1).Cells XLSsheet(4, 4) = "abc" Set XLSsheet = Nothing XLSbook.Close savechanges:=True Set XLSbook = Nothing XLSapp.Quit Set XLSapp = Nothing End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The snippet of code you posted worked fine for me. I only had the existing
instance of excel left running after my 3-4 tests. You may want to make the application visible to help debugging. XLSapp.visible = true And if you have other object variables (that you didn't include in your snippet), make sure they're set to nothing, too. albatros wrote: hi, in the following, there is a simple excel file open, write and close code. It works in my desktop computer very well, I mean it opens the file, writes something and close the file. but in my laptop, it doesn't close. It continues to appear in the task manager, in every time when I used the program, I have to close it in task manager or it will increase as I used the program mean there is 5,6,7...excel.exe program in the task manager. what should I do ? thank you. Dim XLSapp As Excel.Application Dim XLSbook As Excel.Workbook Dim XLSsheet As Object Private Sub Command1_Click() Set XLSapp = New Excel.Application Set XLSbook = XLSapp.Workbooks.Open("c:/test.xls") Set XLSsheet = XLSbook.Worksheets(1).Cells XLSsheet(4, 4) = "abc" Set XLSsheet = Nothing XLSbook.Close savechanges:=True Set XLSbook = Nothing XLSapp.Quit Set XLSapp = Nothing End Sub -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi again,
I found the problem as encarta. I had installed the ms encarta, when I uninstall, the problem gone. Thank you, have a nice day. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Everytime i close an excel file, it creates a new backup file | Excel Discussion (Misc queries) | |||
Have Excel file close itself | Excel Programming | |||
Close a File and Excel ?? | Excel Programming | |||
File close excel does not ask me to save changes | Excel Discussion (Misc queries) | |||
How to Close the entire Excel File | Excel Programming |