Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / June 2007

Tip: Looking for answers? Try searching our database.

killing a excel process from vb

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ravindar thati - 04 Jun 2007 07:07 GMT
dear friends, i am using ms access 2003.

i wanted to export data from access table to excel table.
so i have followed this

Dim db As Database
Dim ea As Excel.Application
Dim rs As Recordset
Dim j As String

Set ea = New Excel.Application
Set db = CurrentDb
ea.Workbooks.Add
ea.Visible = True
Set rs = db.OpenRecordset("SELECT Indicator_Values.year as yea,
Indicator_Values.[Energy use per $1 GDP (PPP)(converted unit)]as eng
FROM Indicator_Values;")
If rs.RecordCount > 0 Then
rs.GetRows
rs.MoveFirst

For i = 1 To rs.RecordCount
j = rs!Yea
k = rs!eng
ea.ActiveSheet.Cells(i, 1).Value = rs!Yea
ea.ActiveSheet.Cells(i, 2).Value = rs!eng
rs.MoveNext

Next
End If
ea.Workbooks.Close
ea.Quit
Set ea = Nothing

i worked out very well this code. i got what output i want.
but the problem here is even if i close the excel window, i see some
excel processes running in the back ground( i viewed it through task
manager).

indeed i have closed the excel window with the code

ea.Quit
set ea=Nothing

even then why the excel process still running in the back ground?
how to kill that process?
Maurice - 04 Jun 2007 19:09 GMT
Create you Excel as an Object this should clear the problem.

So:

Dim ea as Object
Set ea = CreateObject("Excel.application")

also set you workbook and sheet as an object...

hth
Signature

Maurice Ausum

> dear friends, i am using ms access 2003.
>
[quoted text clipped - 42 lines]
> even then why the excel process still running in the back ground?
> how to kill that process?
Perry - 05 Jun 2007 00:17 GMT
This is the problem in yr code

> ea.Workbooks.Add
> ea.Workbooks.Close

Try to use object orientated coding like:
(whereby "ea" is the object variable pointing to the Excel application)

Dim wb as excel.workbook
set wb = ea.workbooks.add
'the rest of your code
wb.close
ea.quit: set ea = nothing

Always use pointers to objects (and child objects) and eliminate these
accordingly like examplified above.

Signature

Krgrds,
Perry

System:
Vista/Office Ultimate
VS2005/VSTO2005 SE

> dear friends, i am using ms access 2003.
>
[quoted text clipped - 42 lines]
> even then why the excel process still running in the back ground?
> how to kill that process?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.