Run a macro on system shutdown?

WrldIntlR

New Member
Joined
Jul 30, 2011
Messages
41
I have a macro that hides excel in the background that turns off remote requests. Half of the people that use it are too lazy to quit the userform before just pulling their cards or abandoning the workstations, so the next time they log in they freak out when Excel won't open any external application.

I've a .vbs that fixes the problem, but I'd prefer not to have to deal with it at all. Is there any way to call a macro on system shutdown?

Thanks,
James
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
You should be able to use the before close event in the ThisWorkbook module

Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
'
'do stuff
'
End Sub
 
Upvote 0
I have a macro that hides excel in the background and turns off remote requests. Half of the people that use it are too lazy to quit the userform before just pulling their ID cards and abandoning their workstations, so the next time they log in they freak out when Excel opens files to an error and a grey screen.

I've a .vbs that fixes the problem, but I'd prefer not to have to deal with it at all. Is there any way to call a macro on system shutdown?

Thanks,
James
 
Upvote 0
Will this work on a forced system time-out shutdown as well? if so, that would be grand. All i need to do is Application.IgnoreRemoteRequests = False.
 
Upvote 0
I can't speak English very well, so I was clarifying my original post. Apparently you can't edit a post after 10 minutes.
 
Upvote 0
This is my code:
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.IgnoreRemoteRequests = False
Application.Close
End Sub

And I'm getting
Runtime Error 438
Object Doesnt' support this property or method.

Any ideas?
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,286
Members
452,902
Latest member
Knuddeluff

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