Hi Tom
I disabled events in the "PrintDisclaimer" macro.
I tested the code and it appeared to work.
--
XL2002
Regards
William
(e-mail address removed)
| since your printing in the BeforePrint event, wouldn't you need to disable
| events?
|
| Private Sub Workbook_BeforePrint(Cancel As Boolean)
| 'Amend sheet name as necessary
| If ActiveSheet.Name = "Sheet1" Then
| Cancel = True
| application.EnableEvents = False
| PrintDisclaimer
| application.enableEvents = True
| End If
| End Sub
|
| --
| Regards,
| Tom Ogilvy
|
|
| | > Steve
| >
| > I didn't read your post fully. To use the code in conjunction with the
| > "BeforePrint" event, place the following in the "ThisWorkbook" module
| >
| > Private Sub Workbook_BeforePrint(Cancel As Boolean)
| > 'Amend sheet name as necessary
| > If ActiveSheet.Name = "Sheet1" Then
| > Cancel = True
| > PrintDisclaimer
| > End If
| > End Sub
| >
| >
| > ... and place this in a general module
| >
| > Sub PrintDisclaimer()
| > 'Amend sheet name, disclaimer, etc as necessary
| > Application.EnableEvents = False
| > Dim x As String
| > x = "This is my disclaimer"
| > With Sheets("Sheet1")
| > .Range("A65000").End(xlUp).Offset(2, 0) = x
| > .PageSetup.PrintArea = .Range(.Range("A1"), _
| > .Range("A" & Rows.Count).End(xlUp).Offset(0, 5)).Address
| > .PrintOut
| > .Range("A65000").End(xlUp).ClearContents
| > End With
| > Application.EnableEvents = True
| > End Sub
| >
| > --
| > XL2002
| > Regards
| >
| > William
| >
| > (e-mail address removed)
| >
| > | > | Hi Steve
| > |
| > | Try the following which places your disclaimer 2 cells below the last
| cell
| > | in column A, sets the print area, prints the sheet and then removes
the
| > | disclaimer. I have assumed the columns to print are Columns A to G.
| > |
| > | Sub PrintDisclaimer()
| > | Dim x As String
| > | 'Amend following line as necessary
| > | x = "This is my disclaimer"
| > | With Sheets("Sheet1")
| > | .Range("A65000").End(xlUp).Offset(2, 0) = x
| > | .PageSetup.PrintArea = .Range(.Range("A1"), _
| > | .Range("A" & Rows.Count).End(xlUp).Offset(0, 5)).Address
| > | .Printout
| > | .Range("A65000").End(xlUp).ClearContents
| > | End With
| > | End Sub
| > |
| > | --
| > | XL2002
| > | Regards
| > |
| > | William
| > |
| > | (e-mail address removed)
| > |
| > | | > | | Thanks in advance to everyone who tries to help me with this.
| > | |
| > | | I have a spreadsheet that serves as a quotation page for services to
| > | | be provided. The number of pages of the quotation varies depending
on
| > | | the amount of services.
| > | |
| > | | My problem is how to automatically insert a disclaimer at the bottom
| > | | of only the last page, just above the footer. I have page numbers
| > | | printing in the footer.
| > | |
| > | | When I select File, Page Setup and hit Enter, the dotted lines
appear
| > | | to show where the page will end, so I can currently cut and paste
the
| > | | five lines of text just above the dotted line. I would like to find
a
| > | | way to automatically locted that dotted line (last row printing on
the
| > | | last page) and insert the lines by using the BeforePrint event.
| > | |
| > | | Any ideas?
| > | |
| > | | Thanks,
| > | |
| > | | Steve
| > | |
| > |
| > |
| >
| >
|
|