Code problem

P

Patrick C. Simonds

Can anyone tell be why the code below will not return False when none of the
3 OptionButtons are True? I have a code line in the UserForm Initialization
that sets the Variable to true and the code below runs when the UserForm is
closed.



Question1 = (Me.OptionButton21 Or Me.OptionButton22 Or Me.OptionButton23)

If Question1 = False Then
ActiveDocument.Variables("Fun").Value = "Incomplete"
End If
 
D

Doug Robbins - Word MVP

It must be some problem with the way in which you are referring to things as
if I have three option buttons on a userform and I show the form and then
click on the commandbutton1, without having clicked one of the
optionbuttons, the message box displays False when the following code is in
the form:

Public Result As Boolean

Private Sub CommandButton1_Click()
Result = (OptionButton1 Or OptionButton2 Or OptionButton3)
MsgBox Result
End Sub

Private Sub UserForm_Initialize()
Result = True
End Sub


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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