Run a macro from workbook then close workbook and let the macro open it again?

Erik83

Board Regular
Joined
Jan 10, 2008
Messages
102
Hi,

I'm trying to do exactly what's in the title. I'm assuming there must be a sub that can continue to function when I close the workbook it exists in and was run in?

Thanks for any help

Best regards

Erik
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
How exactly would it do that? More to the point, why do you need to do that? The nearest equivalent I can think of is to use Application.Ontime to scehdule the macro to run, then close the workbook. As long as the session of Excel is not closed down, at the due time, the workbook will be reopened so that the macro can run.
 
Upvote 0
I'm assuming there must be a sub that can continue to function
no subs will run in the workbook that closes, the sub containing the close statement will not complete

to do what you want you would have to have a new workbook running or an addin, and have the code running in that workbook to close the other workbook, else write out a vbs script file then shell it from your code before closing the workbook

there is probably some other way to do what you want, depending why you are wanting to do it
 
Upvote 0

Forum statistics

Threads
1,214,821
Messages
6,121,759
Members
449,048
Latest member
excelknuckles

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