User Form Interface .... really a simple question!

G

Guest

I've created a user form (for the 1st time!) with 4 control frames and 2
command buttons. Each frame has a number of option buttons. One option in
each frame is selected as the default option. I've even added an image to
make the form a bit fancier !!

So far so good. Now, I'm trying to test this user interface before I add
the functionality to the form.
Trying to click an option button, its control frame and its group frame
appear !
The user form appears to be stuck in its design mode, despite the fact that
the design mode (on the Tool bar) is not on.

What did I do wrong ? How to exit this design mode ?

Do I have to add something to the UserForm_Click () event, at this early
stage, to run / test the form ?

Thank you kindly.
 
C

Chip Pearson

You design and modify userforms in the VBA editor. You test them
in Excel. Create a simple macro in a standard code module (not
the form's code module) to show the form. Run this macro to test
your form in Excel.

Sub ShowTheForm()
Userform1.Show
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
C

Chip Pearson

I should have added that you can press F5 with the form active in
the VBA Editor to run the form.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
G

Guest

Fantastic! Thank you very much.

Now the user interface works fine, as far as clicking the various option
buttons and the tab order for the controls are concerned.

However, there is a slight slef-imposed problem (still within the scope of
user interface)! Since I've not yet developed all the algorithms for the
full matrix of option selections, I've to limit my use of the form (for now)
to only certain options from the predefined lists. Let me explain.

Suppose the 1st control frame is named grpA , and has 2 option control
buttons named: opt1 , opt2
The 2nd control frame is named grpB , and has 3 option control buttons
named: opt3 , opt4 , opt5

If opt1 is selected (in grpA) on the form, then opt4 and opt5 (in grpB)
should be disabled.
If opt2 is selected (in grpA), then opt3 (in grpB) should be disabled.

If isn't too much trouble, could you please show me how to encode the above
conditions using the option button names, and where to place these
conditions. In the UserForm_Click () event ??

Thank you.
 
D

Dave Peterson

How about something like:

Option Explicit
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub OptionButton1_Click()
Me.OptionButton3.Enabled = True
Me.OptionButton4.Enabled = False
Me.OptionButton5.Enabled = False
End Sub
Private Sub OptionButton2_Click()
Me.OptionButton3.Enabled = False
Me.OptionButton4.Enabled = True
Me.OptionButton5.Enabled = True
End Sub
Private Sub UserForm_Initialize()
Me.OptionButton3.Enabled = False
Me.OptionButton4.Enabled = False
Me.OptionButton5.Enabled = False
End Sub

Debra Dalgleish has a getstarted with userforms at:
http://www.contextures.com/xlUserForm01.html
 
G

Guest

Is it possible to minimize the XL w/b and leaves the user form on display ??

I've tried Application.WindowState = XlMinimized , in the standard macro
showing the form. It doesn't yield the desired result!

For this particular application, there is no need (or use) of the host w/b
once the form is displayed. The selected option controls on the form
identify the applicable procedures, and the command controls take care of
locating the procedures on the system, open the relevant files, and unload
the form.

Now since it does not appear possible to show the form without its host w/b,
at least get it out of the way by minimizing it !!!! (XL 2003, Windows XP)

Any suggestions ?? Thank you.
 
V

Vasant Nanavati

When the UserForm is loaded, set Application.Visible = False. Set it back to
True when the UserForm is dismissed,
 
G

Guest

Vasant;
Perfect! Thank you.


Vasant Nanavati said:
When the UserForm is loaded, set Application.Visible = False. Set it back to
True when the UserForm is dismissed,
 

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