[AccessD] Excel Not Closing

Rocky Smolin rockysmolin2 at gmail.com
Mon Apr 10 12:55:16 CDT 2023


Dear List:

I have an app which exports data to an Excel spreadsheet.  It is not
amenable to using TransferSpreadsheet because of formatting problems, etc.
So I use the brute force method and it works well.

Problem is that at the end of the process the user wants the app to open
the spreadsheet.

So I use Application.FollowHyperlink strFileName. Problem is that the
spreadsheet opens blank.

When I go to the folder and open the spreadsheet it's there, all perfect.
So I put a breakpoint in at the statement Application.FollowHyperlink
strFileName and looked at the Task Manager and sure enough there was an
instance of Microsoft Excel still there in the list of background
processes.

If I end that Excel process and then let the app execute the Follow
Hyperlink it opens just fine. So it's that leftover instance of Excel
that's hosing up the works.

 I set the objects like so:

Set objXLApp = New Excel.Application
Set objXLBook = objXLApp.Workbooks.Add
Set objXLWS = objXLBook.Sheets(1)

and at the end close up like so:

objXLBook.SaveAs strFileName
objXLBook.Close True

Set objXLWS = Nothing
Set objXLBook = Nothing

objXLApp.Quit
Set objXLApp = Nothing

How do I get rid of that instance of Excel in the background processes?


MTIA

Rocky


More information about the AccessD mailing list