View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
LauriS LauriS is offline
external usenet poster
 
Posts: 32
Default Print preview error from BeforePrint macro

Using the WONDERFUL knowledge this board is loaded with I was able to answer
a question that came up in my training class. How do you get multiple lines
in your footers and how do you adjust the font size.

I came up with this:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.LeftFooter = "&07" & ActiveWorkbook.FullName & vbLf
& vbLf
End Sub

Using this they can put the page numbering info in the center footer center
(via the menus) and then the macro will put the full path name in a smaller
font (it's a HUGE path name) in the left section of the footer everything is
great.

This prints perfectly ... but when I try to print preview the sheet I get
the following error message:

Method 'FullName' of object '_Workbook' failed

If I pick debug it goes on just fine but I'd rather not have the error.

Is there someplace else I can put the macro that wouldn't cause this error
on previewing??