473,785 Members | 2,457 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Excel object still in memory after Access app runs

RE: Access 2003/Excel 2003
Problem:
After I close the Access application completely, I go out to the Task
Manager and there is an Excel.exe object still sitting out there.

My Access application creates an Excel file (MyTestFile.XLS ) just fine
per the code submitted here. This code closes the Excel file created
and close the Excel application, leaving the Access app open. Then I
close Access. After Access is closed, I go to the task mgr and an
Excel object is still out there.

Question:
How (using VBA) can I check the Task Manager of the Workstation, check
to see if an Excel object is there, and if it is there, flush it from
the Task Manager?
When this output file is created, it needs to be saved regardless.
Can this be done?
This code is from the subroutine that loops through a recordset to
create the Excel file.
<begin code>
'Dim the Excel objects smallest to largest...
Dim objXL As Excel.Applicati on
Dim objWkb As Excel.Workbook
Dim objSht As Excel.Worksheet

Set objXL = New Excel.Applicati on

With objXL
Set objWkb = .Workbooks.Open (conWKB_NAME)
On Error Resume Next
Set objSht = objWkb.Workshee ts(conSHT_NAME)
If Not Err.Number = 0 Then
'MsgBox conSHT_NAME & " was not found in ExcelFile: " &
conWKB_NAME & vbCrLf & _
"so data will be pasted in a new sheet labeled: " &
conSHT_NAME
Set objSht = objWkb.Workshee ts.Add
objSht.Name = conSHT_NAME
End If
Err.Clear
On Error GoTo 0
> ....Do Excel stuff here
to create the output .XLS file.... <<

'Close Excel objects in reverse order they were declared...
'Closing Sheet, Workbook, Application...
Set objSht = Nothing
Set objWkb = Nothing
Set objXL = Nothing
<end code>

thnx....

Mar 21 '07 #1
3 7176
On Mar 21, 3:48 pm, rlntemp-...@yahoo.com wrote:
RE: Access 2003/Excel 2003
Problem:
After I close the Access application completely, I go out to the Task
Manager and there is an Excel.exe object still sitting out there.

My Access application creates an Excel file (MyTestFile.XLS ) just fine
per the code submitted here. This code closes the Excel file created
and close the Excel application, leaving the Access app open. Then I
close Access. After Access is closed, I go to the task mgr and an
Excel object is still out there.

Question:
How (using VBA) can I check the Task Manager of the Workstation, check
to see if an Excel object is there, and if it is there, flush it from
the Task Manager?
When this output file is created, it needs to be saved regardless.
Can this be done?

This code is from the subroutine that loops through a recordset to
create the Excel file.
<begin code>
'Dim the Excel objects smallest to largest...
Dim objXL As Excel.Applicati on
Dim objWkb As Excel.Workbook
Dim objSht As Excel.Worksheet

Set objXL = New Excel.Applicati on

With objXL
Set objWkb = .Workbooks.Open (conWKB_NAME)
On Error Resume Next
Set objSht = objWkb.Workshee ts(conSHT_NAME)
If Not Err.Number = 0 Then
'MsgBox conSHT_NAME & " was not found in ExcelFile: " &
conWKB_NAME & vbCrLf & _
"so data will be pasted in a new sheet labeled: " &
conSHT_NAME
Set objSht = objWkb.Workshee ts.Add
objSht.Name = conSHT_NAME
End If
Err.Clear
On Error GoTo 0
> ....Do Excel stuff here
to create the output .XLS file.... <<

'Close Excel objects in reverse order they were declared...
'Closing Sheet, Workbook, Application...
Set objSht = Nothing
Set objWkb = Nothing
Set objXL = Nothing
<end code>

thnx....

throw the following at the end (Where you close the sheet):

objWkb.close
objXL.quit

Mar 21 '07 #2
rlntemp,

You never close the workbook: objWkb.Close

You only destroyed the reference to it.

-- Bill

<rl*********@ya hoo.comwrote in message
news:11******** **************@ l77g2000hsb.goo glegroups.com.. .
RE: Access 2003/Excel 2003
Problem:
After I close the Access application completely, I go out to the Task
Manager and there is an Excel.exe object still sitting out there.

My Access application creates an Excel file (MyTestFile.XLS ) just fine
per the code submitted here. This code closes the Excel file created
and close the Excel application, leaving the Access app open. Then I
close Access. After Access is closed, I go to the task mgr and an
Excel object is still out there.

Question:
How (using VBA) can I check the Task Manager of the Workstation, check
to see if an Excel object is there, and if it is there, flush it from
the Task Manager?
When this output file is created, it needs to be saved regardless.
Can this be done?
This code is from the subroutine that loops through a recordset to
create the Excel file.
<begin code>
'Dim the Excel objects smallest to largest...
Dim objXL As Excel.Applicati on
Dim objWkb As Excel.Workbook
Dim objSht As Excel.Worksheet

Set objXL = New Excel.Applicati on

With objXL
Set objWkb = .Workbooks.Open (conWKB_NAME)
On Error Resume Next
Set objSht = objWkb.Workshee ts(conSHT_NAME)
If Not Err.Number = 0 Then
'MsgBox conSHT_NAME & " was not found in ExcelFile: " &
conWKB_NAME & vbCrLf & _
"so data will be pasted in a new sheet labeled: " &
conSHT_NAME
Set objSht = objWkb.Workshee ts.Add
objSht.Name = conSHT_NAME
End If
Err.Clear
On Error GoTo 0
> ....Do Excel stuff here
to create the output .XLS file.... <<

'Close Excel objects in reverse order they were declared...
'Closing Sheet, Workbook, Application...
Set objSht = Nothing
Set objWkb = Nothing
Set objXL = Nothing
<end code>

thnx....

Mar 21 '07 #3
>>objWkb.clos e
objXL.quit<<

Matt,
This worked! Thank you for this suggestion.
When my application closes, the Excel reference in Task Manager is
destroyed as it should be.

I inherited all this code, so am stumped on a couple more items
here....

When ICCDataOut.XLS exists:
A new sheet is added to this .XLS file (sheet2, sheet3, sheet4, etc.)
This is ok, but I might look later into creating a custom string for a
particular run and placing the date-time on the sheet tab name.

I probably need to interrogate to see if ICCDataOut.XLS exists first.
(Are there efficient ways to do this in VBA?)
If it exists, check to see if the there is a sheet called
"ICCDataShe et". If there is not, then use "ICCDataShe et" as the sheet
name.
If the output file does not exist, I need to open the Excel object
with a new file, run code to load it up, then save the sheet and file
upon closing the Access form.

Currently, when the output .XLS file does not exist, this line errors:
Set objWkb = .Workbooks.Open (conWKB_NAME)
The error is "1004-Application defined or object defined error"
Is there a way to bypass this error so it would open a new sheet
anyway in the event that this file did not exist prior to creation?
Here is the code I have thus far:
Const conSHT_NAME = "ICCDataShe et"
Const conWKB_NAME = "C:\ICC\ICCData Out.XLS"

Set objXL = New Excel.Applicati on

With objXL
Set objWkb = .Workbooks.Open (conWKB_NAME)
On Error Resume Next
Set objSht = objWkb.Workshee ts(conSHT_NAME)
If Not Err.Number = 0 Then
' conSHT_NAME was not found in Excel File - conWKB_NAME
' data will be pasted in a new sheet labeled: " &
conSHT_NAME
Set objSht = objWkb.Workshee ts.Add
objSht.Name = conSHT_NAME
DebugPrint "Excel File is: " & conWKB_NAME & "/ Added
New sheet: " & objSht.Name
Else
DebugPrint "Excel File is: " & conWKB_NAME & "/ Using
Existing sheet: " & objSht.Name
End If

Err.Clear
On Error GoTo 0 'not sure if this is actually needed here (?)

End With
thnx....

Mar 22 '07 #4

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

Similar topics

6
9862
by: geronimo_me | last post by:
Hi, I am trying to run an Excel macro from an Access module, however when I run the code the macro runs but then I get an error in Access. The error is: Run-time error "440", Automation error. My code is: Sub Run_Excel_Macro() Dim xls, xlWB As Object
1
2825
by: Jake | last post by:
Good Day All, Sorry if I am posting in the wrong forum, hopefully someone will be able to push me in the right direction. What I am trying to accomplish is allowing a client to upload an Excel file and then I need to access the Excel file without saving the file directly to the server. What I am eventually going to do is save the Excel data into a database. Here is a sample of what I am trying to do, and I may be way off track here. ...
3
3337
by: hari krishna | last post by:
hi, I am generating excel reports through vb.Net. After creating excel.application and the report is generated, each report leaves Excel in memory. I can see them in task manager in Process tab (as EXCEL). So the memory has been taken by excel objects and memory is being full. i want to delete or kill this objects which are in memory. i wrote the code as 'myexcel.quit()' , myexcel=nothing. but still it is in memory. pls tell me how to...
8
2183
by: jack | last post by:
Access is denied. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.UnauthorizedAccessException: Access is denied. ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET...
12
2434
by: D. Shane Fowlkes | last post by:
This most likely belongs in another forum but I thought I'd start here. I have a COM Object written in VB6. The DLL will access MS Excel and use it's Object Library to write a customized report and saves it to a folder. The DLL even writes to a log for each step it takes so we can troubleshoot the problems (if any). This works fine on one machine but not another. The folder the DLL is trying to write to has full permissions assigned...
4
3087
by: Rich Wallace | last post by:
Hi all, I have a VB app that runs and manages individual XLS files within a single COM object. Upon processing the final fie, I attempt to close out the EXCEL object and release it using System.Runtime.InteropServices.Marshal.ReleaseComObject. I have a Try...Catch in my routine as seen below and when I receive the error, my Catch is never called so my app sees the release as successful, but when I look in Task Manager, the EXCEL.EXE...
5
2780
by: RJN | last post by:
Hi I'm invoking the excel object from ASP.Net application. My development machine is Windows 2000 and MS Office is installed on my m/c. I have added reference to the Excel COM object, I have given Access and launch permissions to ASPNET user in DCOMCNFG and the identity set to launch user. But I get the following error, moment I try to create the Excel object: Dim oexcel As New Excel.Application "COM object with CLSID...
10
8159
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 and excel is closed. But there are some commented lines: //xlSeries.XValues = xlWs.get_Range("B2", "B4"); // makes com objects, but which...
16
5191
by: Phil Stanton | last post by:
I have a form with a button which is supposed to open an Excel file (With lots of Macros /VBA) in it. The Excel file gets it's data from the Access program Here is the code Private Sub Storage_Click() On Error GoTo Err_Storage_Click
0
9645
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
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10325
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
10147
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
10091
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,...
1
7499
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6739
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
5381
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...
1
4050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.