View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Mike[_65_] Mike[_65_] is offline
external usenet poster
 
Posts: 32
Default Pre-checking checkboxes in a dialog box

Bob

Thanks for this and your time - it's much appreciated [I realise that
sometimes it's not possible to provide the end result without knowing all
the facts]. I guess it's time for me to pull my finger out and really sit
down and figure it all out myself.

Will let you know how it goes.

Thanks again

Mike


"Bob Phillips" wrote in message
...
Mike,

I understood the question, but as I don't have all of the details, all I

can
do is give some guidance.

As you correctly said, the code at the moment sets all of the checkboxes
because the loop doesn't do any differential test. Let's assume that you
have a Long variable, let's call it nVersion, that is set as follows (I
assume you already have code to determine what type of role your user is)
0 - Executive
1 - Full
2 - Standard
the code might look something like this

PrintDlg.CheckBoxes.Add 78, TopPos, 150, 16.5
PrintDlg.CheckBoxes(SheetCount).Text = _
SetCheckBoxes PinrtDlg, nVersion, SheetCount
...

and then create the new SedtCheckBoxes procedure

Sub SetCheckBoxes(PrintDlg As DialogSheet, Version As Long, SheetIndex As
Integer)

Select Case Version
Case 0:
Select Case SheetIndex
Case 1: PrintDlg.CheckBoxes(SheetIndex).Value = False
Case 2: PrintDlg.CheckBoxes(SheetIndex).Value = True
Case 3: PrintDlg.CheckBoxes(SheetIndex).Value = True
End Select
Case 1:
Select Case SheetIndex
Case 1: PrintDlg.CheckBoxes(SheetIndex).Value = False
Case 2: PrintDlg.CheckBoxes(SheetIndex).Value = False
Case 3: PrintDlg.CheckBoxes(SheetIndex).Value = True
End Select
Case 2:
Select Case SheetIndex
Case 1: PrintDlg.CheckBoxes(SheetIndex).Value = False
Case 2: PrintDlg.CheckBoxes(SheetIndex).Value = False
Case 3: PrintDlg.CheckBoxes(SheetIndex).Value = False
End Select
End Select

End Sub


Obviously, you would need to adapt to the number of sheets, the number of
variations, and what the actual boxes to be checked are.


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Mike" wrote in message
...
Bob

Another reply - sorry - but I guess what I'm asking is can I have some

help
on "add the test for Executive etc.,"

Thanks

Mike



"Bob Phillips" wrote in message
...
Mike,

When the checkbox is added, you need to set the value to True. So in

John's
example, the checkbox is added with

PrintDlg.CheckBoxes.Add 78, TopPos, 150, 16.5
PrintDlg.CheckBoxes(SheetCount).Text = _

you then need to ad the line

PrintDlg.CheckBoxes(SheetCount).Value = True

Clearly you need to adapt to your code, and add the test for Executive

etc.,
but that is the basic principle.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Mike" wrote in message
...

I have used some VBA script that I obtained from John Walkenbach's

website
(specifically, http://j-walk.com/ss/excel/tips/tip48.htm) to provide

users
with a dialog box to choose a selection of worksheets to print, in

my
case
using the modification under the link show that is suggested to

ensure
continuous page numbering. It works great.

I have multiple user groups, however, and have a good idea of what
different
'packs' these different user groups might want (that is, depending

on
their
seniority/role, they may want the "Executive version", the

"Full/Standard
version", etc.. and the version choice should drive standardised,
different
worksheet selections).

Can I adapt the script to pre-check only certain checkboxes, so that

when
the macro for the "Executive version" is run, say, the dialog box

shows
up
as before but the user is just confirming rather than actively

choosing
a
selection of worksheets? This way, at least they'll see/appreciate

what
they're not getting in choosing the more summary versions of the

different
'packs' provided, which they wouldn't get if I wrote a standard

macro
to
just print the relevant worksheet selection.

Thanks in advance for any help

Mike