Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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





.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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




.



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
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM
Insert "-" in text "1234567890" to have a output like this"123-456-7890" Alwyn Excel Discussion (Misc queries) 3 October 25th 05 11:36 PM


All times are GMT +1. The time now is 06:48 AM.

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"