Many thanks, but I've not explained properly because
the same is occurring.
I've moved the code that loads the listbox items into
the code behind the form as follows:
Private Sub CommandButton1_Click()
With GetUserWkbkPrintOptions.ListBox1
If ListBox1.Selected(0) = True Then
Wkbk_HideSameCols = True
End If
If ListBox1.Selected(1) = True Then
Wkbk_HideDifferentCols = True
End If
If ListBox1.Selected(2) = True Then
Wkbk_DoNotHideCols = True
End If
If ListBox1.Selected(3) = True Then
Wkbk_PrintAllZeroPages = True
End If
If ListBox1.Selected(4) = True Then
Wkbk_PrintSomeZeroPages = True
End If
If ListBox1.Selected(5) = True Then
Wkbk_DoNotPrintZeroPages = True
End If
If ListBox1.Selected(6) = True Then
Wkbk_PrintAllBlankPages = True
End If
If ListBox1.Selected(7) = True Then
Wkbk_PrintSomeBlankPages = True
End If
If .ListBox1.Selected(8) = True Then
Wkbk_DoNotPrintBlankPages = True
End If
End With
Unload Me
End Sub
and 'remmed the same code in the calling module.
The options are being highlighted in the Listbox, but when
returned to the calling sub, the variables are not set.
Do I need something for CommandButton1 (ie the left
mouse button)? Is this the root problem?
Regards.
"Orlando Magalhães Filho" wrote in message
...
Hi Stuart,
Now test this code. It works fine for me.
Private Sub UserForm_Initialize()
'Fill the ListBox
With GetUserWkbkPrintOptions.ListBox1
.RowSource = ""
.AddItem "You want to hide the same Columns"
' etc
' etc
.AddItem "You don't want to print any blank pages"
End With
'GetUserWkbkPrintOptions.Show You don't need this line!!!
End Sub
Private Sub CommandButton1_Click()
With GetUserWkbkPrintOptions.ListBox1
If ListBox1.Selected(0) = True Then
Wkbk_HideSameCols = True
End If
If ListBox1.Selected(1) = True Then
Wkbk_HideSameCols = True
End If
End With
Unload Me
End Sub
--
HTH
---
Orlando Magalhães Filho
(So that you get best and rapid solution and all may benefit from the
discussion, please reply within the newsgroup, not in email)
"Stuart" escreveu na mensagem
...
From the module, this calls the form:
GetUserWkbkPrintOptions.Show
then in the form:
Private Sub UserForm_Initialize()
'Fill the ListBox
With GetUserWkbkPrintOptions.ListBox1
.RowSource = ""
.AddItem "You want to hide the same Columns"
etc
etc
.AddItem "You don't want to print any blank pages"
End With
GetUserWkbkPrintOptions.Show
End Sub
The form shows and user makes their selection.
Clicking the OKButton hides the form and returns to the
module code:
'get user's workbook-specific print options
With GetUserWkbkPrintOptions.ListBox1
If GetUserPrintOptions.ListBox1.Selected(0) = True Then
Wkbk_HideSameCols = True
End If
etc.
When I step through all appears ok, but when the routine
returns to the above last code, it simply checks each line for
True or False....it doesn't pick up the Selected items from
the Listbox.
What am I doing wrong, please?
Regards.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.509 / Virus Database: 306 - Release Date: 12/08/2003
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.509 / Virus Database: 306 - Release Date: 12/08/2003