ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dialogs (https://www.excelbanter.com/excel-programming/393226-dialogs.html)

OlieH

Dialogs
 
I wish to diable the print capability on the
Application.Dialogs(xlDialogPrintPreview).Show command. That is I just want
them to see the form and not be able to print it at this time.
(Office 2003)
I appreciate all the help. Thanks.
OlieH

Jim Thomlinson

Dialogs
 
There is no way to change the print preview dialog. What you can do is to
handle the print event however. Set up a global variable and check it in the
before print event... something like this

Public NOT_OK_TO_PRINT as boolean 'False by default

sub whatever()
NOT_OK_TO_PRINT = true
Application.Dialogs(xlDialogPrintPreview).Show
NOT_OK_TO_PRINT = False
end sub

In thisworkbook module
Private Sub Workbook_BeforePrint(Cancel As Boolean)
if NOT_OK_TO_PRINT then cancel = true
End Sub

The above code is untested but it should be close to what you want...
--
HTH...

Jim Thomlinson


"OlieH" wrote:

I wish to diable the print capability on the
Application.Dialogs(xlDialogPrintPreview).Show command. That is I just want
them to see the form and not be able to print it at this time.
(Office 2003)
I appreciate all the help. Thanks.
OlieH


OlieH

Dialogs
 
Jim, thanks for the help. I must be missing something. After declaring
"NOT_OK,..", I entered the Private sub code and then tried to execuite the
NOT OK set code and tried the dialogs(xldialogprintpreview).show code.
However the system still allowed me to print the form. What am I missing?
Again, I really appreciate your help.

"Jim Thomlinson" wrote:

There is no way to change the print preview dialog. What you can do is to
handle the print event however. Set up a global variable and check it in the
before print event... something like this

Public NOT_OK_TO_PRINT as boolean 'False by default

sub whatever()
NOT_OK_TO_PRINT = true
Application.Dialogs(xlDialogPrintPreview).Show
NOT_OK_TO_PRINT = False
end sub

In thisworkbook module
Private Sub Workbook_BeforePrint(Cancel As Boolean)
if NOT_OK_TO_PRINT then cancel = true
End Sub

The above code is untested but it should be close to what you want...
--
HTH...

Jim Thomlinson


"OlieH" wrote:

I wish to diable the print capability on the
Application.Dialogs(xlDialogPrintPreview).Show command. That is I just want
them to see the form and not be able to print it at this time.
(Office 2003)
I appreciate all the help. Thanks.
OlieH


OlieH

Dialogs
 
The cancel print works but I do want the operator to PREVIEW the page just
not be able to print it. Any suggestions. Thanks for the help.


"OlieH" wrote:

Jim, thanks for the help. I must be missing something. After declaring
"NOT_OK,..", I entered the Private sub code and then tried to execuite the
NOT OK set code and tried the dialogs(xldialogprintpreview).show code.
However the system still allowed me to print the form. What am I missing?
Again, I really appreciate your help.

"Jim Thomlinson" wrote:

There is no way to change the print preview dialog. What you can do is to
handle the print event however. Set up a global variable and check it in the
before print event... something like this

Public NOT_OK_TO_PRINT as boolean 'False by default

sub whatever()
NOT_OK_TO_PRINT = true
Application.Dialogs(xlDialogPrintPreview).Show
NOT_OK_TO_PRINT = False
end sub

In thisworkbook module
Private Sub Workbook_BeforePrint(Cancel As Boolean)
if NOT_OK_TO_PRINT then cancel = true
End Sub

The above code is untested but it should be close to what you want...
--
HTH...

Jim Thomlinson


"OlieH" wrote:

I wish to diable the print capability on the
Application.Dialogs(xlDialogPrintPreview).Show command. That is I just want
them to see the form and not be able to print it at this time.
(Office 2003)
I appreciate all the help. Thanks.
OlieH



All times are GMT +1. The time now is 04:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com