#1   Report Post  
Posted to microsoft.public.excel.misc
Sloth
 
Posts: n/a
Default Last Saved Date

I did a search on this subject and found the following code (among others,
but I liked this the best). I am new to VBA and was wandering if someone
could help me out. I noticed that since it runs before you save it is really
posting the second to last save date. I figured out that you can do this
when the sheet calculates, or when the sheet opens, etc., but I wanted to
know what I could replace

ThisWorkbook.BuiltinDocumentProperties("Last Save Time")

with, that would show the current time instead.


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Sheets("Sheet1").Range("A1").Value =
ThisWorkbook.BuiltinDocumentProperties("Last Save Time")
Sheets("Sheet1").Range("A2").Value =
ThisWorkbook.BuiltinDocumentProperties("Author")
Sheets("Sheet1").Range("A3").Value = Environ("username")
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default Last Saved Date

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Application.EnableEvents = False
Cancel = True
If SaveAsUI Then
sFile = Application.GetOpenFilename("Excel Files (*.xls), *.xls")
If sFile < False Then
ThisWorkbook.SaveAs sFile
With Sheets("Sheet1")
.Range("A1").Value = _
ThisWorkbook.BuiltinDocumentProperties("Last Save Time")
.Range("A2").Value = _
ThisWorkbook.BuiltinDocumentProperties("Author")
.Range("A3").Value = Environ("username")
End With
End If
Else
ThisWorkbook.Save
With Sheets("Sheet1")
.Range("A1").Value = _
ThisWorkbook.BuiltinDocumentProperties("Last Save Time")
.Range("A2").Value = _
ThisWorkbook.BuiltinDocumentProperties("Author")
.Range("A3").Value = Environ("username")
End With
End If
Application.EnableEvents = True
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Sloth" wrote in message
...
I did a search on this subject and found the following code (among others,
but I liked this the best). I am new to VBA and was wandering if someone
could help me out. I noticed that since it runs before you save it is

really
posting the second to last save date. I figured out that you can do this
when the sheet calculates, or when the sheet opens, etc., but I wanted to
know what I could replace

ThisWorkbook.BuiltinDocumentProperties("Last Save Time")

with, that would show the current time instead.


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As

Boolean)
Sheets("Sheet1").Range("A1").Value =
ThisWorkbook.BuiltinDocumentProperties("Last Save Time")
Sheets("Sheet1").Range("A2").Value =
ThisWorkbook.BuiltinDocumentProperties("Author")
Sheets("Sheet1").Range("A3").Value = Environ("username")
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.misc
Niek Otten
 
Posts: n/a
Default Last Saved Date

Sheets("Sheet1").Range("A1").Value = Date & " " & Time


--
Kind regards,

Niek Otten

"Sloth" wrote in message
...
I did a search on this subject and found the following code (among others,
but I liked this the best). I am new to VBA and was wandering if someone
could help me out. I noticed that since it runs before you save it is
really
posting the second to last save date. I figured out that you can do this
when the sheet calculates, or when the sheet opens, etc., but I wanted to
know what I could replace

ThisWorkbook.BuiltinDocumentProperties("Last Save Time")

with, that would show the current time instead.


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Sheets("Sheet1").Range("A1").Value =
ThisWorkbook.BuiltinDocumentProperties("Last Save Time")
Sheets("Sheet1").Range("A2").Value =
ThisWorkbook.BuiltinDocumentProperties("Author")
Sheets("Sheet1").Range("A3").Value = Environ("username")
End Sub



  #4   Report Post  
Posted to microsoft.public.excel.misc
Sloth
 
Posts: n/a
Default Last Saved Date

Perfect, Thank You.

"Niek Otten" wrote:

Sheets("Sheet1").Range("A1").Value = Date & " " & Time


--
Kind regards,

Niek Otten

"Sloth" wrote in message
...
I did a search on this subject and found the following code (among others,
but I liked this the best). I am new to VBA and was wandering if someone
could help me out. I noticed that since it runs before you save it is
really
posting the second to last save date. I figured out that you can do this
when the sheet calculates, or when the sheet opens, etc., but I wanted to
know what I could replace

ThisWorkbook.BuiltinDocumentProperties("Last Save Time")

with, that would show the current time instead.


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Sheets("Sheet1").Range("A1").Value =
ThisWorkbook.BuiltinDocumentProperties("Last Save Time")
Sheets("Sheet1").Range("A2").Value =
ThisWorkbook.BuiltinDocumentProperties("Author")
Sheets("Sheet1").Range("A3").Value = Environ("username")
End Sub




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
Worksheet Revision Date only once that day mikeburg Excel Discussion (Misc queries) 0 August 16th 05 12:39 AM
search for latest date Sue Excel Worksheet Functions 2 August 2nd 05 11:09 PM
How do I insert the date the file was saved in the MS Excel foote. kacate Excel Discussion (Misc queries) 2 January 31st 05 09:11 PM
How to insert date last saved into the sheet (not the footer) Crispin Morton Excel Worksheet Functions 0 November 26th 04 08:30 AM
Using formulas to determine date in one cell based on date in anot Gary Excel Worksheet Functions 2 November 22nd 04 08:11 AM


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