Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default before print event not working

Hi all

Appears my b4 print event is not working.
When I print I receive no right header or center footer
I tried commenting out the .rh and .cf out of the print routine
Received same results

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Worksheets("Main").Activate
With ActiveSheet.PageSetup
.RightHeader = ActiveSheet.Range("C1").Value
.CenterFooter = ActiveSheet.Range("C2").Value
End With
End Sub

Print Routine:
Sub Print_Main()

Application.ScreenUpdating = False
Worksheets("Main").Select
Range("B4:J47").Select
ActiveSheet.PageSetup.PrintArea = "$B$4:$J$47"
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = "&8&D"
.CenterFooter = ""
.RightFooter = "&8&T"
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = True
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
.PrintErrors = xlPrintErrorsDisplayed
End With
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Range("D7").Select
Application.ScreenUpdating = True
End Su

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default before print event not working

A very cursory look suggests that perhaps you dont have a period before each
item in your with

--
Don Guillett
SalesAid Software

"goss " wrote in message
...
Hi all

Appears my b4 print event is not working.
When I print I receive no right header or center footer
I tried commenting out the .rh and .cf out of the print routine
Received same results

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Worksheets("Main").Activate
With ActiveSheet.PageSetup
RightHeader = ActiveSheet.Range("C1").Value
CenterFooter = ActiveSheet.Range("C2").Value
End With
End Sub

Print Routine:
Sub Print_Main()

Application.ScreenUpdating = False
Worksheets("Main").Select
Range("B4:J47").Select
ActiveSheet.PageSetup.PrintArea = "$B$4:$J$47"
With ActiveSheet.PageSetup
PrintTitleRows = ""
PrintTitleColumns = ""
LeftHeader = ""
CenterHeader = ""
RightHeader = ""
LeftFooter = "&8&D"
CenterFooter = ""
RightFooter = "&8&T"
LeftMargin = Application.InchesToPoints(0.75)
RightMargin = Application.InchesToPoints(0.75)
TopMargin = Application.InchesToPoints(1)
BottomMargin = Application.InchesToPoints(1)
HeaderMargin = Application.InchesToPoints(0.5)
FooterMargin = Application.InchesToPoints(0.5)
PrintHeadings = False
PrintGridlines = False
PrintComments = xlPrintNoComments
PrintQuality = 600
CenterHorizontally = False
CenterVertically = False
Orientation = xlPortrait
Draft = False
PaperSize = xlPaperLetter
FirstPageNumber = xlAutomatic
Order = xlDownThenOver
BlackAndWhite = True
Zoom = False
FitToPagesWide = 1
FitToPagesTall = 1
PrintErrors = xlPrintErrorsDisplayed
End With
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Range("D7").Select
Application.ScreenUpdating = True
End Sub


---
Message posted from
http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default before print event not working

Thanks Don

There is a . before each item within the With statement.
Any other ideas?


---
Message posted from http://www.ExcelForum.com/

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
Change Event not working on 1 machine jlclyde Excel Discussion (Misc queries) 2 January 20th 10 07:15 PM
Print a range when an event happens kefee85 Excel Discussion (Misc queries) 4 February 16th 09 10:42 PM
worksheet change event not working Jase Excel Discussion (Misc queries) 2 October 27th 08 03:45 PM
Workbook_Open event not working jason Excel Programming 2 September 7th 03 04:02 PM
Worksheet_Change Event Not Working Michael Beckinsale Excel Programming 0 August 1st 03 02:43 PM


All times are GMT +1. The time now is 11:32 PM.

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"