So to build on this, You are running an access program, this program opens an excel spreadsheet... and that is the sheet we are wanting to close...
The code bit we are fiddling with will give the PID of the current application that is being ran..... hmmm.... wow.... lemme think....
How about... is it possible to save some vba behind the spreadsheet we are trying to close? I know we can call subs from one app to another...
This is my code in a spreadsheet, that calls a sub in my access application.
BUT if your access program is generating this spreadsheet from scratch, and not from a template... I don't know how to get the code behind it...Code:Public Sub ProcedureInAccess() Dim acApp As Object Dim db As Object Set acApp = CreateObject("Access.Application") acApp.OpenCurrentDatabase ("C:\Program Files\LIFT\LIFT.mde") acApp.Visible = False Set db = acApp acApp.Run "CreateHTMLMail" acApp.Quit Set acApp = Nothing ' All macros designed and distributed by the LIFT team End Sub
Possibly creating an excel addon... (.xla) i think... That way you can run whatever macro or code behind ANY excel doc that is open... only problem being is the xla file would need to be loaded onto every users PC... Don't know if that would be an issue or not.
---------------
To comment further and off topic... I like how these approaches are extensive, long and fairly complex... to do something as simple as shutdown excel... It's one of those things, that once you figure out how to do... is almost laughable...I had an issue with a checkbox in IE, I was trying to change its value.. I was stuck for days... then i finally figured it out.. and the response I received was, wow... a check mark in a checkbox...