PDA

View Full Version : Solved: footer code error



koala
07-07-2009, 05:00 AM
Hi forum,

I am trying to get automated data into a footer and am using the following code:

With ActiveSheet.PageSetup
.RightFooter = "Date Page Printed:" & [Date] & vbLf & _
"Time Page Printed:" & [Time] & vbLf & _
"Printed by:" & Application.UserName

End With

However something is wrong as it says I have a runtime error '13' .. type mismatch

Also how do I change the font to size 8.

Any help is greatly appreciated.

Koala

Bob Phillips
07-07-2009, 05:22 AM
With ActiveSheet.PageSetup
.RightFooter = "&8Date Page Printed:" & Date & vbLf & _
"Time Page Printed:" & Time & vbLf & _
"Printed by:" & Application.UserName

End With

koala
07-07-2009, 05:47 AM
Thanks xld,

That works great, (those damn square brackets), however it takes up lots of space so I changed to

With ActiveSheet.PageSetup
.RightFooter = "&8 Printed by: " & Application.UserName & " on " & Date & " at " & Time

End With

to get one line which I think looks neater on the printout

Can you also point me how to change the date format to "ddd, dd mmm yyyy", so I can compare that as well.

Thanks again, your help is appreciated

Koala

koala
07-07-2009, 05:55 AM
Solved it

With ActiveSheet.PageSetup
.RightFooter = "&8 Printed by: " & Application.UserName & " on " & Format(Date, "ddd, dd mmm yyyy") & " at " & Time

End With

Thanks again for your help xld

GTO
07-07-2009, 05:59 AM
@XLD
Nice :-) I wouldn't have thought to ditch the formatting code &D right away at least.

@Koala:
Try:
Format(Date, "ddd, dd mmm yyyy")

A good day to all,

Mark