ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Placing a code before Save & Save As (https://www.excelbanter.com/excel-programming/341186-placing-code-before-save-save.html)

Alex Martinez

Placing a code before Save & Save As
 

Hi,

I am using Excel 2002 and I want to place a code before my user actually
Save the worksheet or use the Save As using the standard menu and tool bar.
How do I place a code there? The save and save as are in the MS Excel
menu/tool bar. I just want to place a code to do a simple copy and paste.
I don't know how to access so I can place me code. Any tips will be
appreciated. Thank you




R.VENKATARAMAN

Placing a code before Save & Save As
 
you have to use an event code
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)

in the vbeditor open vbproject (control+R)
doube click <thisworkbook under your file
under the new window on the left hand side choose <workbook
on the riht hand side choose <before_save
place the code here
save the file

whenever you save the file the code will fire.


--
remove $$$ from email addresss to send email
======================

"Alex Martinez" wrote in message
...

Hi,

I am using Excel 2002 and I want to place a code before my user actually
Save the worksheet or use the Save As using the standard menu and tool

bar.
How do I place a code there? The save and save as are in the MS Excel
menu/tool bar. I just want to place a code to do a simple copy and paste.
I don't know how to access so I can place me code. Any tips will be
appreciated. Thank you







All times are GMT +1. The time now is 09:35 AM.

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