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!
|
|
|
|