ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   set up a command button or macro for open file to "save as" (https://www.excelbanter.com/excel-programming/332579-set-up-command-button-macro-open-file-save.html)

Mo

set up a command button or macro for open file to "save as"
 
I have a workbook that uses many macros. I like to create a macro within a
form that allows user to "save as" file before exiting excel.


Thanks,
Mo

Leith Ross[_54_]

set up a command button or macro for open file to "save as"
 

Hello Mo,

Do the following to display the Save As dialog whenever the Workbook is
closed...

1) Select the Macro code and press *CTRL + C* to copy it
2) Open your Workbook
3) Press *ALT + F11 * to open the VBE
4) Press *ALT + R* to display and activate the Project Explorer
5) Press *T*, ThisWorkbook should be highlighted, if not, Click on it
6) Press *CTRL + V* to paste the Macro code
7) Press *CTRL +S* to save the macro


Code:
--------------------
Private Sub Workbook_BeforeClose(Cancel As Boolean)

Application.Dialogs(xlDialogSaveAs).Show

End Sub
--------------------


Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=381425



All times are GMT +1. The time now is 10:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com