Not sure what your problem is as I do not know what code you are using. But I can tell you that the before_print code is called twice when the print preview is used, once to view the preview the second when you choose to print. I used this to confirm.
Sub Workbook_BeforePrint(Cancel As Boolean)
MsgBox "Would print at this point."
End Sub
Private Sub Workbook_beforeprint(Cancel As Boolean)
If worksheetname = "" Then
Cancel = True
Application.Run ("printer1")
End If
End Sub
sub printer1()
'goes through a bunch of if statements
'then diplays a form with a print button
'and a cancel button
'but throughout the whole macro Cancel=False
'so in the print button is the Print command
'and the cancel button just closes the form
end sub
ANY IDEAS?????
end sub
what i wanted to happen was if print preview is chosen then you view print preview normally and then if you chose to print it after that the form would appear, any help is appreciated. Not sure what your problem is as I do not know what code you are using. But I can tell you that the before_print code is called twice when the print preview is used, once to view the preview the second when you choose to print. I used this to confirm.
The problem seems to be issolating which button (print or print preview) was clicked. Havent found away to determine this yet. Private Sub Workbook_beforeprint(Cancel As Boolean)
end sub : Not sure what your problem is as I do not know what code you are using. But I can tell you that the before_print code is called twice when the print preview is used, once to view the preview the second when you choose to print. I used this to confirm. : Sub Workbook_BeforePrint(Cancel As Boolean) : MsgBox "Would print at this point." : End Sub :