the first event that occurs after a file is done saving?

  • Thread starter Thread starter Conan Kelly
  • Start date Start date
C

Conan Kelly

Hello all,

What is the first event that occurs immediately after a workbook is done saving?

There is a Before_Save event, but there is no After_Save event.

I have a file that takes a while to save to the server. I wanted to time how long it takes to save. I thought about putting
"Activecell = Now()" in the Before_Save event, then activate the cell below it. Then when it is done saving, put "Activecell =
Now()" in the appropriate event procedure, but I don't know what that is.

If anyone has a better way of doing this or any other suggestions, I'm all ears
 
hi,
try something like this. just change the file path to your file path.
Sub macTimer()

' Macro written 11/8/2006 by FSt1

Range("A1").FormulaR1C1 = "=NOW()"
Range("A1").NumberFormat = "h:mm:ss"
ActiveWorkbook.SaveAs Filename:= _
"C:YourFilePathGoesHere\deleteme.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False
Range("B1").FormulaR1C1 = "=NOW()"
Range("B1").NumberFormat = "h:mm:ss"
End Sub

regards
FSt1
 
In your sub routine you could use:

Activecell = Now()
ThisWorkBook.Save
Activecell.Offset(1,0) = Now()
 
Use BeforeSave

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Dim nTime As Double
Application.EnableEvents = False
Cancel = True
nTime = Now
ThisWorkbook.Save
MsgBox Now - nTime
Application.EnableEvents = True
End Sub


--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

Conan Kelly said:
Hello all,

What is the first event that occurs immediately after a workbook is done saving?

There is a Before_Save event, but there is no After_Save event.

I have a file that takes a while to save to the server. I wanted to time
how long it takes to save. I thought about putting
"Activecell = Now()" in the Before_Save event, then activate the cell
below it. Then when it is done saving, put "Activecell =
 
Jim,

Thank you for your help.

After some thinking (before anyone replied) I came up with something similar in its own sub procedure.

(0:01:09 to save to the old server, 0:00:08 - 0:00:09 to save to the new server)

Thanks again for the feedback.

Conan
 
I'm glad you got it worked out. I realized when I saw FSt1's reply that I
left out the cell formatting to show the seconds. Sometimes, when one tried
to answer before anyone else, things get left out.

Best wishes,

Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top