Controling Custom Dialog Box - Word 2000

J

jbc

Hi,

I'm working on a custom dialog box. I'm in the beginning stages and am
running into a problem.

I have 2 frames with option buttons and one check box.
The user has to make a selection in the first frame. If the user selects
the 4th button the second frame and the check box become enabled. They can
choose an option button from the 2nd frame OR the check box.

They must choose an option button in the second frame OR the check box.

If they choose an option button or the check box ... no problem.
Right now when they hit OK and leave both (2nd frame and check box)
unselected the dialog box closes. How do i keep the dialog box from closing
and keep the option button in the first frame selected?

Hope this makes sense.

jbc
 
D

Doug Robbins - Word MVP

I would suggest that you replace the checkbox with an additional option
button in the second frame, then you will not have to worry about code to
check whether the user has selected an option AND also the Check Box.

Use something like the following code in the event that is presently closing
the form

Dim opt As Boolean
Dim i As Long
If Frame2.Visible = True then
opt = False
For i = 1 To Frame2.Controls.Count
Set acontrol = Frame2.Controls(i - 1)
If acontrol.Value = True Then
opt = True
Exit For
End If
Next i
If opt = False Then
MsgBox "Must make a Selection from Frame 2"
Exit Sub
Else
'Do what you want to do as a result of the selected option
Me.Hide
End If
Else
'Do what you want to do if a button other than the fourth button in
Frame1 is selected
Me.Hide
End if


--
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
 
J

jbc

Doug,

Thanks for your suggestion. I rearranged the dialog box and now it is
working much better.

jbc
 

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