A
Al
I am running Excel from MS Access. Basically I populate some cells from
Access data and then save and activate the workbook. After closing excel an
Excel.exe process remains in task manager. How do I get this to end and
still show the workbook?
Code is:
Dim appExcel As Object
Dim WBook As Object
'OPEN EXCEL
Set appExcel = CreateObject("Excel.Application")
Set WBook = appExcel.Workbooks.Open(strTemplateDir & strWBName)
Excel.Application.DisplayAlerts = False
With appExcel
.Range("A11").Value = Nz(Trim(rst![CustomerName]), " ")
.Range("A12").Value = Nz(Trim(rst![Address]), " ")
.Range("A13").Value = Nz(Trim(rst![City]), " ") & ", " & _
Nz(Trim(rst![State]), " ") & " " & Nz(Trim(rst![Zip]), " ")
.ActiveWorkbook.SaveAs filename:=strDocDir & strFileName, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
.Visible = True
End With
ErrorHandlerExit:
rst.Close
Set rst = Nothing
Set WBook = Nothing
Set appExcel = Nothing
Exit Sub
Access data and then save and activate the workbook. After closing excel an
Excel.exe process remains in task manager. How do I get this to end and
still show the workbook?
Code is:
Dim appExcel As Object
Dim WBook As Object
'OPEN EXCEL
Set appExcel = CreateObject("Excel.Application")
Set WBook = appExcel.Workbooks.Open(strTemplateDir & strWBName)
Excel.Application.DisplayAlerts = False
With appExcel
.Range("A11").Value = Nz(Trim(rst![CustomerName]), " ")
.Range("A12").Value = Nz(Trim(rst![Address]), " ")
.Range("A13").Value = Nz(Trim(rst![City]), " ") & ", " & _
Nz(Trim(rst![State]), " ") & " " & Nz(Trim(rst![Zip]), " ")
.ActiveWorkbook.SaveAs filename:=strDocDir & strFileName, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
.Visible = True
End With
ErrorHandlerExit:
rst.Close
Set rst = Nothing
Set WBook = Nothing
Set appExcel = Nothing
Exit Sub