Saving workbook using part of a file name

vavs

Well-known Member
Joined
Jul 2, 2004
Messages
514
I have a workbook that is created every month and the name changes month to month. I have a macro stored in the workbook that creates new tabs and saves them. I can save and close these workbooks relatively easily. I want to be able to close the main workbook, but the name will change so I cannot close using the workbooks("workbookname").close function. Is there a way to add a wildcard to the name to allow me to close when the processing is done? Is there an option to save and close?
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Where is the code that you want to close the workbook from located?

If it's in the workbook itself you can use ThisWorkbook.Close to close it.
 
Upvote 0

Forum statistics

Threads
1,215,315
Messages
6,124,207
Members
449,147
Latest member
sweetkt327

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