Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default After save event

Hi,
I want to execute some code just after the user saved the
file. In excel97 I could not find something like an
AfterSave event (although a BeforeSave exsist).
Anybody any ideas?

Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 535
Default After save event

Hi,

You can use an OnTime event to fire a macro after the
save, but you do need to ensure the save has actually
taken place. E.g.:

In a normal module:

Sub AfterTheSave()
If Thisworkbook.Saved=True then
Msgbox "Saved, or at least not modified since last save"
Else
Msgbox "Not saved!"
End If
End Sub

In the Thisworkbook module:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean,
Cancel As Boolean)
Application.OnTime Now, "AfterTheSave"
End Sub

Regards,

Jan Karel Pieterse
Excel TA/MVP

-----Original Message-----
Hi,
I want to execute some code just after the user saved the
file. In excel97 I could not find something like an
AfterSave event (although a BeforeSave exsist).
Anybody any ideas?

Thanks


.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default After save event

AFAIK there is no easy way of doing this.

An off the top of my head solution would involve this.

In the BeforeSave event start a timer with an delay of around a couple of
seconds. The code for this will be whatever you want to execute upon saving
completion. In most cases I would imagine setting a delay of around a few
seconds would be sufficient although you would be the best judge. If Excel
is still busy saving the file the event will not be fired until it's
complete so this perhaps won't mater so much.

This is not very elegent and a bit fragile. So to enhance it you could
check the file date/time stamp before the save then in your code executed on
the timer you re-read this to make sure the file has been updated.

Whatever you implement I think it'll be a bit clumsy but it should be
possible to get the desired effect. Would like to hear of other suggestions
though.


--

Regards,


Bill Lunney
www.billlunney.com

"Bart" wrote in message
...
Hi,
I want to execute some code just after the user saved the
file. In excel97 I could not find something like an
AfterSave event (although a BeforeSave exsist).
Anybody any ideas?

Thanks




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
Timer event dhstein Excel Discussion (Misc queries) 2 June 18th 09 04:16 PM
event vba irosh Excel Worksheet Functions 4 November 11th 08 09:25 AM
VBA Event Steve Excel Discussion (Misc queries) 2 October 14th 08 11:04 PM
event marker68 Excel Discussion (Misc queries) 1 April 4th 08 02:38 PM
Save As - Before Save Event, VB, another name Danny Excel Worksheet Functions 0 March 15th 07 05:57 PM


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

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"