Thread: Print problem
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
RJH RJH is offline
external usenet poster
 
Posts: 44
Default Print problem

I'm using Excel 2000 in WinXP.
When I press the print preview button the BeforePrint routine below works
fine.

ThisWorkbook:
Private Sub Workbook_BeforePrint(Cancel As Boolean) 'Set header &
footer
ActiveSheet.PageSetup.CenterHeader = "&30 &B" & "" & Format("Laser
Department" & Chr(10) _
& "CHROMM Usage - " & ActiveSheet.Name)
ActiveSheet.PageSetup.CenterFooter = "&16 " & "" & Format(Now(),
"mmmm-dd-yyyy,") & " &T"
End Sub

But when the BeforePrint routine is triggered with the macro below the
header and date don't update although the time updates fine....
(the macro is assigned to a custom toolbar button)

Sub Print_Sheets()
Dim Printer As String

Printer = Application.Dialogs(xlDialogPrinterSetup).Show 'printer
select
If Printer = "False" Then Exit Sub
'cancel, exit

Sheets(Sheets.Count - 1).Activate
'210 active
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=False,
ActivePrinter:=Printer
Sheets(Sheets.Count).Activate
'130 active
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=False
End Sub

Can anyone explain this or point me in the right direction ???
Thanks!

RJH