Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Print problem

Perhaps a well placed Application.DoEvents might help? Maybe after this
line?

Sheets(Sheets.Count - 1).Activate


Just a thought....

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Print problem

? Application.Dialogs(xlDialogPrinterSetup).Show
True

So printer will hold a value of "True" or "False" not the printer
selected - although the printer selected will be set as the default if it
equals True.

--
Regards,
Tom Ogilvy





"RJH" wrote in message
...
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




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

I've solved the problem.
I put the footer in the page setup.
I moved the header into the 'Print Sheets' macro.
Now, everything works fine.

I tried the DoEvents but it didn't help.
Tom, I didn't really understand what you were trying to tell me.

Thanks for the help.

RJH


"RJH" wrote in message
...
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



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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Print to Fit Problem JD Excel Discussion (Misc queries) 0 May 22nd 08 05:04 PM
Print Problem Loretta Excel Discussion (Misc queries) 4 January 10th 07 11:35 PM
Print Problem TN.Jim Excel Discussion (Misc queries) 1 December 23rd 04 03:23 PM
Print problem Tom Ogilvy Excel Programming 1 September 22nd 04 05:37 AM
Print problem Terrance Rebello Excel Programming 0 September 21st 04 10:47 PM


All times are GMT +1. The time now is 08:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"