File name suggestion to read only workbook when save as dialog box pops up

newbieX

New Member
Joined
Jul 24, 2013
Messages
35
Is there any way, using VBA, to set the file name in the save as dialog box when the user exits the workbook or selects the save/save as via the File menu, The workbook is protected as read only and the save as dialog box automatically pops up as a result; however, I want to have a filename suggestion in the pathname. It will be saved in the current folder. There will not be a save button. I want this to be held as a variable and accessed during close or save. Oh, and I want to remove the protections but not the coding behind the scenes. I would post code but honestly I don't know where to start. All the suggestions seem to execute the code on some action (such as a save button) other than the user just closing and/or saving the document. which is not what I want. The filename will be based on a value in a cell but when this file gets saved will be up to the user, not on when the cell value changes. The filename will be based on worksheet 7, cell b3. Using Office 365.

BTW, one thing I've noticed when trying various coding suggestions thus far, when using the Workbook.BeforeSave event, the code isn't recognized unless I use ctrl s shortcut. When going through the File menu the code is not recognized.

Any and all help will be greatly appreciated.
 

Some videos you may like

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Watch MrExcel Video

Forum statistics

Threads
1,127,653
Messages
5,626,101
Members
416,161
Latest member
David1966Lewis

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
Top