Application.Dialogs(xlDialogPrint).Show

L

Luc

Hoi there,

I want to use the code "Application.Dialogs(xlDialogPrint).Show", but by
default i would like that 'All the worksheets" are selected when this
dialog opens.

Can it be done ???


Thanks,

Luc
 
C

Charabeuh

Hello

To select a worksheet and to made it the selected worksheet:
Worksheets("MyName").select

To select a worksheet and to add it to the actual selection of worksheets :
Worksheets("MyName").select False

To select all the worksheet:

Sub SelectAllWorksheets()
Dim xW As Worksheet

Worksheets(1).Select
For Each xW In Worksheets
xW.Select False
Next xW

End Sub
 
R

Rick Rothstein

This seems to work...

Application.Dialogs(xlDialogPrint).Show 2,1,ThisWorkbook.Sheets.Count
 
K

K_Macd

Luc

Group selection of a number of sheets is a nice feature especially for
printing but note that it can also be a very dangerous feature and that I
suggest that after closing the print dialog you have code to select only one
sheet so as to avoid corruption in active but not visible sheets.

Within the print dialog there is the ability to select the whole workbook -
a better idea would be to be able to open the dialog with that option set and
if someone can enlighten one on how I would be very pleased.
 
R

Rick Rothstein

See inline comments...
Group selection of a number of sheets is a nice feature especially for
printing but note that it can also be a very dangerous feature and that I
suggest that after closing the print dialog you have code to select only
one
sheet so as to avoid corruption in active but not visible sheets.

No where in my posting did I select all the sheets in the workbook (not did
I say the user should do that manually either)... the single line of code I
posted simply calls up the print dialog box with the option to print all the
sheets selected **in the dialog box only**... this does not select any
sheets in the workbook nor is it dependent on that being done.
Within the print dialog there is the ability to select the whole
workbook -
a better idea would be to be able to open the dialog with that option set
and
if someone can enlighten one on how I would be very pleased.

I actually had that option working... once... but when I experimented with
other settings, I found I could no longer make the "select whole workbook"
option work again. Not being sure why this was the case, I figured it was
safer to offer the method I posted which always worked for me no matter what
other settings I tried.
[/QUOTE]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top