Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 144
Default Can I have code executed after Save?

Hi all,

I'm trying to have a sub called to execute after a workbook is saved --
literally, I would like the code to execute as soon as the file is saved, but
not before, as the sub is storing the name of the workbook in a cell in the
worksheet. I need the name to be current with whatever the name of the
worksheet is at any given time. I see that there is a Workbook level command
that executes before Save, but I don't see anything for after Save.

Thanks for your help!



--
Robert
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 367
Default Can I have code executed after Save?

Why don't you let Excel enter the filename by itself:
http://office.microsoft.com/en-us/ex...346271033.aspx

hth
carlo

On Dec 21, 3:59*pm, robs3131
wrote:
Hi all,

I'm trying to have a sub called to execute after a workbook is saved --
literally, I would like the code to execute as soon as the file is saved, but
not before, as the sub is storing the name of the workbook in a cell in the
worksheet. *I need the name to be current with whatever the name of the
worksheet is at any given time. *I see that there is a Workbook level command
that executes before Save, but I don't see anything for after Save.

Thanks for your help!

--
Robert


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 434
Default Can I have code executed after Save?

hi, !

I'm trying to have a sub called to execute after a workbook is saved -- literally
I would like the code to execute as soon as the file is saved, but not before
as the sub is storing the name of the workbook in a cell in the worksheet.
I need the name to be current with whatever the name of the worksheet is at any given time.
I see that there is a Workbook level command that executes before Save, but I don't see anything for after Save.
Thanks for your help!


besides the cell("filename") worksheet function (suggested by carlo)
you can "handle" your _beforesave event to execute a procedure "after_save" if you...

1) use a general code module to define a normal sub-procedure (to be executed "after_save") i.e.

Option Private Module
Sub After_Saved()
MsgBox "This workbook has been saved as:" & vbCr & _
ThisWorkbook.FullName
End Sub

2) in your workbook_beforesave event, use the OnTime method to launch "the sub-procedure"
(which will be executed "after") i.e.

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

hth,
hector.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 144
Default Can I have code executed after Save?

Thanks Hector and Carlo - that helped!

--
Robert


"Héctor Miguel" wrote:

hi, !

I'm trying to have a sub called to execute after a workbook is saved -- literally
I would like the code to execute as soon as the file is saved, but not before
as the sub is storing the name of the workbook in a cell in the worksheet.
I need the name to be current with whatever the name of the worksheet is at any given time.
I see that there is a Workbook level command that executes before Save, but I don't see anything for after Save.
Thanks for your help!


besides the cell("filename") worksheet function (suggested by carlo)
you can "handle" your _beforesave event to execute a procedure "after_save" if you...

1) use a general code module to define a normal sub-procedure (to be executed "after_save") i.e.

Option Private Module
Sub After_Saved()
MsgBox "This workbook has been saved as:" & vbCr & _
ThisWorkbook.FullName
End Sub

2) in your workbook_beforesave event, use the OnTime method to launch "the sub-procedure"
(which will be executed "after") i.e.

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

hth,
hector.



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
Can I count total lines of VBA Code Executed in a Series of Subs? MikeZz Excel Programming 6 February 20th 07 05:32 PM
part of a code not being executed Valeria Excel Programming 2 September 28th 05 07:55 AM
No file when Save As is executed D.Parker Excel Programming 7 April 2nd 05 12:46 AM
No file when Save As is executed Dave Peterson[_5_] Excel Programming 1 March 30th 05 07:02 PM


All times are GMT +1. The time now is 11:54 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"