![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: England
Posts: 212
|
Is there any code which will allow me to run a macro each time a workbook is saved? Hope someone can help.
Thanks Matt |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Christchurch New Zealand
Posts: 1,030
|
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
End Sub put that code in your this workbook sheet in project explorer [ This Message was edited by: brettvba on 2002-04-16 13:33 ] |
|
|
|
|
|
#3 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
Alt+F11 to access VBA. The left of the screen you will find the project explorer. Double click on ThisWorkbook. Then at the right you will see a big blank sheet. At the top of that sheet you will see a dropdown box titled General. Click on it and select Workbook. Then click the dropdown box to the right that should say Open and select BeforeSave. Enter in the code you want that will occur before a save.
__________________
Kind regards, Al Chara |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Feb 2002
Location: England
Posts: 212
|
Perfect! Thanks for your quick response guys.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|