Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Help on VBA.

I am using Excel 2000

I want to print the following information in the footer:

1. File path, File name and worksheet name
2. Print Date and time in the print out
3. Last Saved by user "xyz"
4. Last saved time
5. Page numer

I am currently using the following VBA code in my file:
VBAProject(mario.xls) Microsoft Excel Objects
ThisWorkBook

----------------------------------------------------------
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet.PageSetup
.LeftFooter = "&8" & _
LCase(ActiveWorkbook.FullName) & "; Worksheet:"
& " &A " & _
vbCrLf & "Printed on:" & Format(Now(), "dd-mmm-
yyyy")
.RightFooter = "&8" & "Page &P of &N"
End With
End Sub
----------------------------------------------------------

Please help me with

1. How to go to the next line in footer after printing
the file name & path. "vbcrlf" actually introduces an
empty line and then prints on the second line., which I
dont want

2. What will be the VBA code for Printing the date in the
format like 19 Sept 2003, 13:30

3. What will be the VBA code to print the "Last Saved By"
and "Last Saved time"

Please help.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default Help on VBA.


"mario" wrote in message
...
Please help me with

1. How to go to the next line in footer after printing
the file name & path. "vbcrlf" actually introduces an
empty line and then prints on the second line., which I
dont want


Try vbLf instead of vbCrLf


2. What will be the VBA code for Printing the date in the
format like 19 Sept 2003, 13:30


Can't get 4 char month I am afraid, but can do 3

Format(Now(),"dd mmm dddd, hh:mm")

3. What will be the VBA code to print the "Last Saved By"
and "Last Saved time"


ActiveWorkbook.BuiltinDocumentProperties("Last Author")
and
ActiveWorkbook.BuiltinDocumentProperties("Last Save Time"),

giving a final result of


Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet.PageSetup
.LeftFooter = "&8" & _
LCase(ActiveWorkbook.FullName) & "; Worksheet:" & " &A " & _
vbLf & "Printed on:" & Format(Now(), "dd-mmm-yyyy ") & _
vbLf & "Saved: by " & ActiveWorkbook.BuiltinDocumentProperties("Last
Author") & _
" on " & Format(ActiveWorkbook.BuiltinDocumentProperties("L ast Save
Time"), "dd mmm dddd, hh:mm")
.RightFooter = "&8" & "Page &P of &N"
End With
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Help on VBA.

Hi Mario,

Bob's code for the date formatting should be:

Format(Now(),"dd mmm yyyy, hh:mm")

I'm sure he accidentally put "dddd" instead of "yyyy". You
could also use:

Format(Now(),"dd mmm yyyy, h:mm AM/PM")

If you want to show the time differently.

Regards,
James S

-----Original Message-----

"mario" wrote in message
...
Please help me with

1. How to go to the next line in footer after printing
the file name & path. "vbcrlf" actually introduces an
empty line and then prints on the second line., which I
dont want


Try vbLf instead of vbCrLf


2. What will be the VBA code for Printing the date in

the
format like 19 Sept 2003, 13:30


Can't get 4 char month I am afraid, but can do 3

Format(Now(),"dd mmm dddd, hh:mm")

3. What will be the VBA code to print the "Last Saved

By"
and "Last Saved time"


ActiveWorkbook.BuiltinDocumentProperties("Last Author")
and
ActiveWorkbook.BuiltinDocumentProperties("Last Save

Time"),

giving a final result of


Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet.PageSetup
.LeftFooter = "&8" & _
LCase(ActiveWorkbook.FullName) & "; Worksheet:"

& " &A " & _
vbLf & "Printed on:" & Format(Now(), "dd-mmm-

yyyy ") & _
vbLf & "Saved: by " &

ActiveWorkbook.BuiltinDocumentProperties("Last
Author") & _
" on " & Format

(ActiveWorkbook.BuiltinDocumentProperties("Last Save
Time"), "dd mmm dddd, hh:mm")
.RightFooter = "&8" & "Page &P of &N"
End With
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Help on VBA.

Hey Man,

Thanks a million. Every thing is perfect now.

Have a niece weekend.

Regards
Mario
-----Original Message-----

"mario" wrote in message
...
Please help me with

1. How to go to the next line in footer after printing
the file name & path. "vbcrlf" actually introduces an
empty line and then prints on the second line., which I
dont want


Try vbLf instead of vbCrLf


2. What will be the VBA code for Printing the date in

the
format like 19 Sept 2003, 13:30


Can't get 4 char month I am afraid, but can do 3

Format(Now(),"dd mmm dddd, hh:mm")

3. What will be the VBA code to print the "Last Saved

By"
and "Last Saved time"


ActiveWorkbook.BuiltinDocumentProperties("Last Author")
and
ActiveWorkbook.BuiltinDocumentProperties("Last Save

Time"),

giving a final result of


Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet.PageSetup
.LeftFooter = "&8" & _
LCase(ActiveWorkbook.FullName) & "; Worksheet:"

& " &A " & _
vbLf & "Printed on:" & Format(Now(), "dd-mmm-

yyyy ") & _
vbLf & "Saved: by " &

ActiveWorkbook.BuiltinDocumentProperties("Last
Author") & _
" on " & Format

(ActiveWorkbook.BuiltinDocumentProperties("Last Save
Time"), "dd mmm dddd, hh:mm")
.RightFooter = "&8" & "Page &P of &N"
End With
End Sub



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Help on VBA.


Thanks for your help. Can u suggest how I can save these
changes to default or template file, so that every file I
create have those information on the footer

Thanks

-----Original Message-----
Hi Mario,

Bob's code for the date formatting should be:

Format(Now(),"dd mmm yyyy, hh:mm")

I'm sure he accidentally put "dddd" instead of "yyyy".

You
could also use:

Format(Now(),"dd mmm yyyy, h:mm AM/PM")

If you want to show the time differently.

Regards,
James S

-----Original Message-----

"mario" wrote in message
...
Please help me with

1. How to go to the next line in footer after printing
the file name & path. "vbcrlf" actually introduces an
empty line and then prints on the second line., which

I
dont want


Try vbLf instead of vbCrLf


2. What will be the VBA code for Printing the date in

the
format like 19 Sept 2003, 13:30


Can't get 4 char month I am afraid, but can do 3

Format(Now(),"dd mmm dddd, hh:mm")

3. What will be the VBA code to print the "Last Saved

By"
and "Last Saved time"


ActiveWorkbook.BuiltinDocumentProperties("Last Author")
and
ActiveWorkbook.BuiltinDocumentProperties("Last Save

Time"),

giving a final result of


Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet.PageSetup
.LeftFooter = "&8" & _
LCase(ActiveWorkbook.FullName) & "; Worksheet:"

& " &A " & _
vbLf & "Printed on:" & Format(Now(), "dd-mmm-

yyyy ") & _
vbLf & "Saved: by " &

ActiveWorkbook.BuiltinDocumentProperties("Last
Author") & _
" on " & Format

(ActiveWorkbook.BuiltinDocumentProperties("Last Save
Time"), "dd mmm dddd, hh:mm")
.RightFooter = "&8" & "Page &P of &N"
End With
End Sub

.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default Help on VBA.

Mario,

Notwithstanding my previous typo.

Put the workbook event code into a new, pristine workbook, and save the
file as a template file called Book.xlt in the XLStart directory. Be aware
though, every time you New a workbook, it will throw up the macros dialog.

--

HTH

Bob Phillips

"mario" wrote in message
...

Thanks for your help. Can u suggest how I can save these
changes to default or template file, so that every file I
create have those information on the footer

Thanks

-----Original Message-----
Hi Mario,

Bob's code for the date formatting should be:

Format(Now(),"dd mmm yyyy, hh:mm")

I'm sure he accidentally put "dddd" instead of "yyyy".

You
could also use:

Format(Now(),"dd mmm yyyy, h:mm AM/PM")

If you want to show the time differently.

Regards,
James S

-----Original Message-----

"mario" wrote in message
...
Please help me with

1. How to go to the next line in footer after printing
the file name & path. "vbcrlf" actually introduces an
empty line and then prints on the second line., which

I
dont want


Try vbLf instead of vbCrLf


2. What will be the VBA code for Printing the date in

the
format like 19 Sept 2003, 13:30


Can't get 4 char month I am afraid, but can do 3

Format(Now(),"dd mmm dddd, hh:mm")

3. What will be the VBA code to print the "Last Saved

By"
and "Last Saved time"


ActiveWorkbook.BuiltinDocumentProperties("Last Author")
and
ActiveWorkbook.BuiltinDocumentProperties("Last Save

Time"),

giving a final result of


Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet.PageSetup
.LeftFooter = "&8" & _
LCase(ActiveWorkbook.FullName) & "; Worksheet:"

& " &A " & _
vbLf & "Printed on:" & Format(Now(), "dd-mmm-

yyyy ") & _
vbLf & "Saved: by " &

ActiveWorkbook.BuiltinDocumentProperties("Last
Author") & _
" on " & Format

(ActiveWorkbook.BuiltinDocumentProperties("Last Save
Time"), "dd mmm dddd, hh:mm")
.RightFooter = "&8" & "Page &P of &N"
End With
End Sub

.



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default VBA Help

Hi Bob,

One final help. What will be the VBA code for Created by
and Created on which i should be adding to your code.

Please help
Thanks

-----Original Message-----
Mario,

Notwithstanding my previous typo.

Put the workbook event code into a new, pristine

workbook, and save the
file as a template file called Book.xlt in the XLStart

directory. Be aware
though, every time you New a workbook, it will throw up

the macros dialog.

--

HTH

Bob Phillips

"mario" wrote in message
...

Thanks for your help. Can u suggest how I can save

these
changes to default or template file, so that every

file I
create have those information on the footer

Thanks

-----Original Message-----
Hi Mario,

Bob's code for the date formatting should be:

Format(Now(),"dd mmm yyyy, hh:mm")

I'm sure he accidentally put "dddd" instead of "yyyy".

You
could also use:

Format(Now(),"dd mmm yyyy, h:mm AM/PM")

If you want to show the time differently.

Regards,
James S

-----Original Message-----

"mario" wrote in message
...
Please help me with

1. How to go to the next line in footer after

printing
the file name & path. "vbcrlf" actually introduces

an
empty line and then prints on the second line.,

which
I
dont want


Try vbLf instead of vbCrLf


2. What will be the VBA code for Printing the date

in
the
format like 19 Sept 2003, 13:30


Can't get 4 char month I am afraid, but can do 3

Format(Now(),"dd mmm dddd, hh:mm")

3. What will be the VBA code to print the "Last

Saved
By"
and "Last Saved time"


ActiveWorkbook.BuiltinDocumentProperties("Last

Author")
and
ActiveWorkbook.BuiltinDocumentProperties("Last Save
Time"),

giving a final result of


Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet.PageSetup
.LeftFooter = "&8" & _
LCase(ActiveWorkbook.FullName) & ";

Worksheet:"
& " &A " & _
vbLf & "Printed on:" & Format(Now(), "dd-mmm-
yyyy ") & _
vbLf & "Saved: by " &
ActiveWorkbook.BuiltinDocumentProperties("Last
Author") & _
" on " & Format
(ActiveWorkbook.BuiltinDocumentProperties("Last Save
Time"), "dd mmm dddd, hh:mm")
.RightFooter = "&8" & "Page &P of &N"
End With
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



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