Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Jan 2001
    Thanked 0 Times in 0 Posts

    BeforePrint Event (Win2000/Excel97)

    I have the following code in the BeforePrint section of VBE. The function works correctly when I print from the worksheet, but does not update the header when I print from a macro - even though it is accessing the event (I checked with de######) Anyone have any ideas to correct this? Thanks!

    Private Sub Workbook_BeforePrint(Cancel As Boolean)
    Dim Title
    Title = ActiveSheet.Name & " " & Format(Right(ActiveWorkbook.Names("DataDate").Valu e, 5), "mm/dd/yyyy")
    With ActiveSheet.PageSetup
    .LeftFooter = ActiveWorkbook.FullName
    .CenterHeader = Title
    End With
    End Sub

  2. #2
    2 Star Lounger
    Join Date
    Mar 2002
    Western NY, USA
    Thanked 0 Times in 0 Posts

    Re: BeforePrint Event (Win2000/Excel97)

    I suspect the "ActiveSheet" is the culprit. Be sure the macro which is doing the printing activates the sheet.

    Run the macro as is. Put a break point in this routine. In the imediate window type ? ActiveSheet.Name. That is the sheet which recieves the header settings.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts