close another application vba

Ramses28

New Member
Joined
May 18, 2018
Messages
10
I have the following code to open an external app:

ActiveWorkbook.FollowHyperlink Address:=("\\PublicI\\3.QGIS\MAPA.qgs"), NewWindow:=True

What code can i use to close it?

Thanks
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
the only way i know how is to use windows api but i dont see vba code for it, you can look up the examples in c++ and import the proper functions, setup the proper structures in vba and try it that way... might be a little tough to convert but im pretty sure your only option is to use windows api...

https://stackoverflow.com/questions...ce=google_rich_qa&utm_campaign=google_rich_qa
https://support.microsoft.com/en-us/help/178893/how-to-terminate-an-application-cleanly-in-win32 (this site mentions, in win32, there is no guarantee to close a process cleanly but rather you can take steps to help it close cleanly)

maybe there is vba sample code but i didnt see after a quick google search
 
Last edited:
Upvote 0
If you know the application class name or the exact title name that is displayed in the application main caption bar then you should, hopefully, be able use aome API calls to get its hwnd and then close it.
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,183
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top