• BeforePrint Event (Win2000/Excel97)

    Author
    Topic
    #368818

    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”).Value, 5), “mm/dd/yyyy”)
    With ActiveSheet.PageSetup
    .LeftFooter = ActiveWorkbook.FullName
    .CenterHeader = Title
    End With
    End Sub

    Viewing 0 reply threads
    Author
    Replies
    • #579894

      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.

    Viewing 0 reply threads
    Reply To: BeforePrint Event (Win2000/Excel97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: