VBA code for CreatedBy ("author") and CreatedOn

  • Thread starter Thread starter Mario
  • Start date Start date
M

Mario

What will be the VBA code for Created by (i.e, Author)
and Created on. I Intend to use it in a class module to
insert that information in my excel footer. I am using
excel 2000.

Please help
Thanks
 
For author there is the undocumented (I believe undocumented):

? Thisworkbook.Author
Thomas W. Ogilvy

? thisworkbook.BuiltinDocumentProperties("Creation Date").Value
9/22/03 7:40:20 PM
 
When I use, ActiveWorkbook.BuiltinDocumentProperties
("Creation Date").Value, it throws up some errors. But
when I use on error resume next, it doesnt, for obvious
reason. Is it throwing errors because the creation date
is empty?. When I do the right click on the file name in
windows exploer, then properties, it does have creation
date. I am trying to accomplish these:
1. File Name, Path and Worksheet Name
2. Created by, Created On
3. Last Saved by, Last Saved On
4. Printed by, Printed On.

Following is the piece of VBA code I used:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
'On Error Resume Next
With ActiveSheet.PageSetup
.LeftFooter = "&8" & _
LCase(ActiveWorkbook.FullName) & "; Worksheet:"
& " &A " & vbLf & _
"Created by " &
ActiveWorkbook.BuiltinDocumentProperties("Author") & "
on " & ActiveWorkbook.BuiltinDocumentProperties("Creation
Date").Value & vbLf & _
"Last Saved by " &
ActiveWorkbook.BuiltinDocumentProperties("Last Author")
& " on " & Format(ActiveWorkbook.BuiltinDocumentProperties
("Last Save Time"), "dddd dd mmm yyyy, hh:mm AM/PM") &
vbLf & _
"Printed by " & Application.UserName & " on " &
Format(Now(), "dddd dd mmm yyyy, hh:mm AM/PM")
.RightFooter = "&8" & "Page &P of &N"
End With
'On Error GoTo 0
End Sub

All of the part is working fine except for the Create
Date.

Please help.

Thanks
 
I know Excel 97 doesn't maintain last save time, and since you have all four
references in a single command, it might be that property that is causing
the problem.

If you are getting an error, then it probably means the property is empty.
 
Back
Top