ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA code for CreatedBy ("author") and CreatedOn (https://www.excelbanter.com/excel-programming/277743-vba-code-createdby-author-createdon.html)

mario

VBA code for CreatedBy ("author") and CreatedOn
 
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

Ron de Bruin

VBA code for CreatedBy ("author") and CreatedOn
 
ActiveWorkbook.BuiltinDocumentProperties("Author")

See the VBA help for a list

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Mario" wrote in message ...
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




Tom Ogilvy

VBA code for CreatedBy ("author") and CreatedOn
 
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

--
Regards,
Tom Ogilvy



Ron de Bruin wrote in message
...
ActiveWorkbook.BuiltinDocumentProperties("Author")

See the VBA help for a list

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Mario" wrote in message

...
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






mario

VBA code for CreatedBy ("author") and CreatedOn
 


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



-----Original Message-----
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

--
Regards,
Tom Ogilvy



Ron de Bruin wrote in message
...
ActiveWorkbook.BuiltinDocumentProperties("Author")

See the VBA help for a list

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Mario" wrote in message

...
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





.


Tom Ogilvy

VBA code for CreatedBy ("author") and CreatedOn
 
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.

--
Regards,
Tom Ogilvy

mario wrote in message
...


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



-----Original Message-----
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

--
Regards,
Tom Ogilvy



Ron de Bruin wrote in message
...
ActiveWorkbook.BuiltinDocumentProperties("Author")

See the VBA help for a list

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Mario" wrote in message

...
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




.





All times are GMT +1. The time now is 08:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com