Thread: Help on VBA.
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_5_] Bob Phillips[_5_] is offline
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

.