Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to EXIT Excel app in Access module.

Status
Not open for further replies.

emma113

Programmer
Nov 30, 2001
8
US
I have 3 modules in an Access DB all 3 open Excel workbook and either write to it ot read from it. Two of these modules open/read the same excel workbook. I use MSscheduler to start Access DB. After one module is finish I close and quit workbook, but if I check TASK MANAGER I see EXCEL is running, this causes to prevent the 2nd module to open the same excel workbook.


Option Explicit

Dim objexcel As excel.Application
Dim objWorkbook As excel.Workbook
Dim objSheet As excel.Worksheet

Dim objWorkbook1 As excel.Workbook
Dim objSheet1 As excel.Worksheet

Dim objSheet3 As excel.Worksheet


Set objexcel = New excel.Application
Set objWorkbook = objexcel.Workbooks.Open(excelFile)
Set objSheet = objWorkbook.Worksheets(1)

Set objWorkbook1 = objexcel.Workbooks.Open(excel_pnlfile1)

objWorkbook1.Worksheets(2).Activate

With ActiveSheet
Cntr = 1
Do While .Cells(Cntr, 41) <> &quot;K Misc&quot;
Debug.Print Cntr
Cntr = Cntr + 1
If Cntr > 4000 Then
Debug.Print Cntr
GoTo out_1
End If
Loop
'
' For Kirkland:
'
out_1:
Kpnl_total_1 = .Cells(Cntr, 43)

objWorkbook.Save 'saves changes

objWorkbook.Application.Quit


Set objWorkbook = Nothing
Set objexcel = Nothing

Set objWorkbook = Nothing

' objWorkbook.Close


This closes the Excel in my Access app. but if I check the TASK MANAGER the excel still running.

Thank You very much.

Sako



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top