473,399 Members | 3,603 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,399 software developers and data experts.

how close excel object

Hello, All!
i try the following text from mvps.org

Sub sTestXL()
Dim objXL As Object
Dim strWhat As String, boolXL As Boolean
Dim objActiveWkb As Object

If fIsAppRunning("Excel") Then
Set objXL = GetObject(, "Excel.Application")
boolXL = False
Else
Set objXL = CreateObject("Excel.Application")
boolXL = True
End If
when i adding next code
the excel.exe is not closed after code complete
why?

' objXL.Application.Workbooks.Open "c:\1.xls"
'Set objActiveWkb = objXL.Application.ActiveWorkbook

'With objActiveWkb
'Worksheets("Sheet1").Range("A2").Select
'Worksheets("Sheet1").Range("A2").EntireRow.Insert
' End With

objActiveWkb.Close savechanges:=True

If boolXL Then objXL.Application.QUIT

Set objActiveWkb = Nothing: Set objXL = Nothing
' MsgBox strWhat
End Sub
With best regards, Stalker. E-mail: ra****@inbox.ru

Nov 12 '05 #1
1 14947
Killing the object variables doesn't close the app. You need to explicitly
close it
objXL.Quit
--
Reggie

"Half this game is 90% mental."

----------
"Andrei Ryazanov" <ra**@inbox.ru> wrote in message
news:bk***********@ID-101406.news.uni-berlin.de...
Hello, All!
i try the following text from mvps.org

Sub sTestXL()
Dim objXL As Object
Dim strWhat As String, boolXL As Boolean
Dim objActiveWkb As Object

If fIsAppRunning("Excel") Then
Set objXL = GetObject(, "Excel.Application")
boolXL = False
Else
Set objXL = CreateObject("Excel.Application")
boolXL = True
End If
when i adding next code
the excel.exe is not closed after code complete
why?

' objXL.Application.Workbooks.Open "c:\1.xls"
'Set objActiveWkb = objXL.Application.ActiveWorkbook

'With objActiveWkb
'Worksheets("Sheet1").Range("A2").Select
'Worksheets("Sheet1").Range("A2").EntireRow.Insert
' End With

objActiveWkb.Close savechanges:=True

If boolXL Then objXL.Application.QUIT

Set objActiveWkb = Nothing: Set objXL = Nothing
' MsgBox strWhat
End Sub
With best regards, Stalker. E-mail: ra****@inbox.ru

Nov 12 '05 #2

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

Similar topics

14
by: IanW | last post by:
I don't know if this is in the right place but.. I am writing a VB.Net Class Library which uses Excel to produce workbooks If I create an instance of Excel and then close it I can get .NET to...
5
by: Richie | last post by:
I want to close excel application from C#, this is the piece of code I am trying "System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp);" GC.Collect(); It ain't working ! Any ideas...
1
by: Gary Cobden | last post by:
Hi I have a routine that uses VBA to open a hidden occurence of Excel, and do background computations. However, in the event that the routine terminates abnormally, I have not been able to...
3
by: David Berman | last post by:
Hi, I've written an application to do a while bunch of Excel automation. I open a file, scan through all the worksheets, extract data, and then I try to close Excel. However, I can see that I'm...
3
by: Maciej Pietruszka | last post by:
My app read from Excel file using Excel's COM dll I create Excel object by: Excel.Application ExcelObj = new Excel.Application(); and next make it inivisible: ExcelObj.Visible = false; ...
8
by: SteveS | last post by:
I'm attempting to close EXCEL from within my VB.NET application. Using the excel object library to write data to my spreadsheet is working fine but when I try to quit application object it does not...
7
by: SteveS | last post by:
I'm attempting to close EXCEL from within my VB.NET application. Using the excel object library to write data to my spreadsheet is working fine but when I try to quit application object it does not...
10
by: Hendri Adriaens | last post by:
Hi, I'm trying to automate the creation of an excel file via COM. I copied my code below. I read many articles about how to release the COM objects that I create. The code below runs just fine...
4
by: Scott | last post by:
I'm trying to get access to open, refresh and then close an excel spreadsheet for me. Below is the code I'm using to open and close Excel, I just can't get it to refresh my data linked back to my...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.