View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Karen53 Karen53 is offline
external usenet poster
 
Posts: 333
Default Before Print Problem

Hi Dave,

Thanks for your help.

Yes, enable events is on and it is the correct address. I have found that
if I select 'Print Preview' it corrects the problem and the page prints
correctly. If I change the cell value and do not 'Print Preview' first, the
header does not update with the new value. What is this? Do you know?
--
Thanks for your help.
Karen53


"Dave Peterson" wrote:

Are you sure you have the correct addresses in your code?

(You may want to give them nice range names and use those instead--it may be
safer if rows/columns can be inserted/deleted.)

Are you sure you still have .enableevents set to true before you print/print
preview?

It could be other code that turns that off--and doesn't turn it back on.

Karen53 wrote:

Hi,

I have the following BeforePrint routine in my ThisWorkbook module which
places a custom header on pages based on the value of cells in the sheet. It
worked except now if the value of the cell changes, it is not picking up the
change and stays with the old value in the header. This there something I
am missing?

Private Sub Workbook_BeforePrint(Cancel As Boolean)

'add custom header to pages before printing

With SumbyLineItempg.PageSetup
.CenterHeader = "&C&14&B" & SumbyLineItempg.Range("E2").Value & _
"&4" & vbCrLf & "&12&A" & vbCrLf & " "
End With

With LineItemspg.PageSetup
.CenterHeader = "&C&14&B" & LineItemspg.Range("C2").Value & _
"&4" & vbCrLf & "&12&A" & vbCrLf & " "
End With

With MainPagepg.PageSetup
.CenterHeader = "&C&14&B" & MainPagepg.Range("B1").Value & _
"&4" & vbCrLf & "&12&A" & vbCrLf & " "
End With

End Sub
--
Thanks for your help.
Karen53


--

Dave Peterson