Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default How to update last save time & last author for each worksheet

Hello. I found code that allows me to display document properties for
a workbook and I am using it to show the last save time and last author
as well as other document properties. But I think the code only
updates the first worksheet. Would I need to add the code to each
worksheet or is there a way to have it update all worksheets
simultaneously?
Thanks.
Here's the code:
<code
Sub DocumentPropertiesLastModified()
Dim a As String
Dim b As String
Dim c As String
Dim d As String
'Worksheets(1).Activate
d = ActiveWorkbook.BuiltinDocumentProperties("title")
Cells(1, 1).Select
ActiveCell.FormulaR1C1 = d
a = ActiveWorkbook.BuiltinDocumentProperties("last save time")
Cells(2, 5).Select
ActiveCell.FormulaR1C1 = "last modified:" & " " & a
b = ActiveWorkbook.BuiltinDocumentProperties("Author")
Cells(1, 5).Select
ActiveCell.FormulaR1C1 = "created by:" & " " & b
c = ActiveWorkbook.BuiltinDocumentProperties("Last author")
Cells(3, 5).Select
ActiveCell.FormulaR1C1 = "last edited by:" & " " & c
End Sub
</code

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default How to update last save time & last author for each worksheet

Try:

Sub DocumentPropertiesLastModified()
Dim Ttle As String
Dim lstSave As String
Dim Athr As String
Dim lstAthr As String
Dim wks As Worksheet

With ActiveWorkbook
Ttle = .BuiltinDocumentProperties("title")
lstSave = .BuiltinDocumentProperties("last save time")
Athr = .BuiltinDocumentProperties("Author")
lstAthr = .BuiltinDocumentProperties("Last author")

For Each wks In .Worksheets
wks.Cells(1, 1).FormulaR1C1 = Ttle
wks.Cells(2, 5).FormulaR1C1 = _
"last modified:" & " " & lstSave
wks.Cells(1, 5).FormulaR1C1 = "created by:" & " " & Athr
wks.Cells(3, 5).FormulaR1C1 = _
"last edited by:" & " " & lstAthr
Next wks
End With
End Sub

Hope this helps
Rowan

the majestic ferny wrote:
Hello. I found code that allows me to display document properties for
a workbook and I am using it to show the last save time and last author
as well as other document properties. But I think the code only
updates the first worksheet. Would I need to add the code to each
worksheet or is there a way to have it update all worksheets
simultaneously?
Thanks.
Here's the code:
<code
Sub DocumentPropertiesLastModified()
Dim a As String
Dim b As String
Dim c As String
Dim d As String
'Worksheets(1).Activate
d = ActiveWorkbook.BuiltinDocumentProperties("title")
Cells(1, 1).Select
ActiveCell.FormulaR1C1 = d
a = ActiveWorkbook.BuiltinDocumentProperties("last save time")
Cells(2, 5).Select
ActiveCell.FormulaR1C1 = "last modified:" & " " & a
b = ActiveWorkbook.BuiltinDocumentProperties("Author")
Cells(1, 5).Select
ActiveCell.FormulaR1C1 = "created by:" & " " & b
c = ActiveWorkbook.BuiltinDocumentProperties("Last author")
Cells(3, 5).Select
ActiveCell.FormulaR1C1 = "last edited by:" & " " & c
End Sub
</code

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default How to update last save time & last author for each worksheet

That worked! Thanks a lot Rowan :)

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default How to update last save time & last author for each worksheet

You're welcome. You may want to include this in the workbook_open event
so that it is kept up to date.

the majestic ferny wrote:
That worked! Thanks a lot Rowan :)

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default How to update last save time & last author for each worksheet

Aha! That was my next question. I realized it wouldn't update till I
ran the code.
Got that working, but is there a way to do it on Save? Or does it
really matter?

Rowan Drummond wrote:
You're welcome. You may want to include this in the workbook_open event
so that it is kept up to date.

the majestic ferny wrote:
That worked! Thanks a lot Rowan :)




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default How to update last save time & last author for each worksheet

Only you would know if it really matters. I would probably go for the
workbook_open event. Paste the following in the ThisWorkbook module in
the VBA project.

Private Sub Workbook_Open()
Dim Ttle As String
Dim lstSave As String
Dim Athr As String
Dim lstAthr As String
Dim wks As Worksheet

With Me
Ttle = .BuiltinDocumentProperties("title")
lstSave = .BuiltinDocumentProperties("last save time")
Athr = .BuiltinDocumentProperties("Author")
lstAthr = .BuiltinDocumentProperties("Last author")

For Each wks In .Worksheets
wks.Cells(1, 1).FormulaR1C1 = Ttle
wks.Cells(2, 5).FormulaR1C1 = _
"last modified:" & " " & lstSave
wks.Cells(1, 5).FormulaR1C1 = "created by:" & " " & Athr
wks.Cells(3, 5).FormulaR1C1 = _
"last edited by:" & " " & lstAthr
Next wks
End With
End Sub

Regards
Rowan

the majestic ferny wrote:
Aha! That was my next question. I realized it wouldn't update till I
ran the code.
Got that working, but is there a way to do it on Save? Or does it
really matter?

Rowan Drummond wrote:

You're welcome. You may want to include this in the workbook_open event
so that it is kept up to date.

the majestic ferny wrote:

That worked! Thanks a lot Rowan :)



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
Update Date, Time Only Upon Save Paul Calcagno Excel Discussion (Misc queries) 1 April 23rd 09 09:07 PM
workbook update each time a new worksheet is selected DJL New Users to Excel 3 December 15th 05 01:48 PM
Update workbook each time a different worksheet is selected DJL New Users to Excel 2 December 15th 05 01:45 PM
save from template to worksheet without update commands Office User Excel Programming 3 May 14th 05 07:19 AM
Time stamping - automated by worksheet update George[_16_] Excel Programming 5 December 8th 03 02:24 PM


All times are GMT +1. The time now is 02:10 PM.

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

About Us

"It's about Microsoft Excel"