Checking the status of a checkbox in a user form
If you want it to happend when the userform is opened, then set the tabindex
property of that button to zero.
Setting the default property to zero would have no effect on focus. It
executes the click event if you hit enter in the form.
--
Regards,
Tom Ogilvy
"Peter Rooney" wrote in message
...
Tom,
Perhaps I'm not asking for the right thing. When the userform is
displayed,
I want to set the focus to the OK button without having to set its
"Dafault"
property to TRUE. I know I COULD do it that way, but I wan't to know if it
IS
possible to set the focus to other command buttons, should the need arise
in
future. I don't have any other setfocus commands in my code.
Regards
Pete
"Tom Ogilvy" wrote:
xlOn is used for checkboxes from the forms toolbar. For your
checkboxes,
use True and False.
The best way to control movement through a userform is using the
tabindex
property.
If for some reason you want to violate that order, then setfocus would
be
the principal command to use. If it isn't working, it could be possible
that other settings/code are interfering. (possibly you use setfocus in
an
event before the normal tabbing has been applied).
--
Regards,
Tom Ogilvy
"Peter Rooney" wrote in message
...
Good afternoon!
I wonder could some clever person confirm that I'm using the correct
syntax?
I have a user form called FolderForm - it contains a number of
checkboxes,
one of which is named "DirectEnttyCheckBox".
When I show the form, I check the status of the box with
If DirectEntryCheckBox.Value = xlOn Then
MsgBox ("Direct Entry")
'other code...
End If
but when I display the form, check the box, and click the OK button
(called
"OKButton", which runs a procedure containing the above code, plus
validation
checking for other checkboxes too) the message "Direct Entry" isn't
displayed.
While I'm on the subject, can anyone also suggest how I set the focus
to
"OKButton"? I tried "OKButton.setfocus" but it didn't make any
difference.
Can anyone see what I'm doing wrong?
Regards & thanks in advance
Pete
|