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) <> "K Misc"
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
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) <> "K Misc"
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