Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 312
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
After Save Event help Steph[_3_] Excel Programming 2 June 27th 05 07:00 PM
Before Save as Event needed [email protected] Excel Programming 4 April 20th 04 07:42 PM
Worksheet Save Event ExcelMonkey[_17_] Excel Programming 3 January 24th 04 03:04 PM
save as event scrabtree23 Excel Programming 1 October 5th 03 10:14 PM
After save event Bart[_3_] Excel Programming 2 July 22nd 03 12:07 PM


All times are GMT +1. The time now is 08:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"