Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Example After Save Event
Hi. Does anyone have an example of some 'After Save' event code? I
understand it doesn't exist, but can be accomplished by using a Before Save event and cancelling the Event, then doing something else? Any help would be appreicated. Thanks in advance! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Example After Save Event
Something like the following may be what you are after:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Cancel = True '<Optional - Your other code here ThisWorkbook.Save '<Optional - More of your other code here End Sub The above must reside in the "ThisWorkbook" module, which is where I copied the "Private Sub..." line from. If you go into that module and select "Workbook" from the top left-hand side drop down and then select "BeforeSave" from the right-hand drop down it writes the basic subroutine for you. HTH. "Steph" wrote: Hi. Does anyone have an example of some 'After Save' event code? I understand it doesn't exist, but can be accomplished by using a Before Save event and cancelling the Event, then doing something else? Any help would be appreicated. Thanks in advance! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Example After Save Event
I think you need to disable events before your save (and enable after) or
you'll be in an endless loop. -- Jim "quartz" wrote in message ... | Something like the following may be what you are after: | | Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) | Cancel = True | '<Optional - Your other code here | ThisWorkbook.Save | '<Optional - More of your other code here | End Sub | | The above must reside in the "ThisWorkbook" module, which is where I copied | the "Private Sub..." line from. If you go into that module and select | "Workbook" from the top left-hand side drop down and then select "BeforeSave" | from the right-hand drop down it writes the basic subroutine for you. | | HTH. | | "Steph" wrote: | | Hi. Does anyone have an example of some 'After Save' event code? I | understand it doesn't exist, but can be accomplished by using a Before Save | event and cancelling the Event, then doing something else? Any help would | be appreicated. Thanks in advance! | | | |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Example After Save Event
Oops! Thanks for correction! Sorry for confusion.
"Jim Rech" wrote: I think you need to disable events before your save (and enable after) or you'll be in an endless loop. -- Jim "quartz" wrote in message ... | Something like the following may be what you are after: | | Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) | Cancel = True | '<Optional - Your other code here | ThisWorkbook.Save | '<Optional - More of your other code here | End Sub | | The above must reside in the "ThisWorkbook" module, which is where I copied | the "Private Sub..." line from. If you go into that module and select | "Workbook" from the top left-hand side drop down and then select "BeforeSave" | from the right-hand drop down it writes the basic subroutine for you. | | HTH. | | "Steph" wrote: | | Hi. Does anyone have an example of some 'After Save' event code? I | understand it doesn't exist, but can be accomplished by using a Before Save | event and cancelling the Event, then doing something else? Any help would | be appreicated. Thanks in advance! | | | |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Example After Save Event
Ok, so if I combine the posts, my event will look like the following?:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Cancel = True '<Optional - this would be true before save code application.enableevents = false ThisWorkbook.Save application.enableevents = true '<Optional - this would be after save code End Sub "quartz" wrote in message ... Oops! Thanks for correction! Sorry for confusion. "Jim Rech" wrote: I think you need to disable events before your save (and enable after) or you'll be in an endless loop. -- Jim "quartz" wrote in message ... | Something like the following may be what you are after: | | Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) | Cancel = True | '<Optional - Your other code here | ThisWorkbook.Save | '<Optional - More of your other code here | End Sub | | The above must reside in the "ThisWorkbook" module, which is where I copied | the "Private Sub..." line from. If you go into that module and select | "Workbook" from the top left-hand side drop down and then select "BeforeSave" | from the right-hand drop down it writes the basic subroutine for you. | | HTH. | | "Steph" wrote: | | Hi. Does anyone have an example of some 'After Save' event code? I | understand it doesn't exist, but can be accomplished by using a Before Save | event and cancelling the Event, then doing something else? Any help would | be appreicated. Thanks in advance! | | | |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
After Save Event help | Excel Programming | |||
Before Save as Event needed | Excel Programming | |||
Worksheet Save Event | Excel Programming | |||
save as event | Excel Programming | |||
After save event | Excel Programming |