Multipage control on Excel VBA forms
Hi guys,
I've been writing a small VBA program in Excel. Part of it involves a form
that asks the user for various inputs. I've used a multipage control to
break the form up into two sections.
The trouble I am having is that once the user presses an OK button, I have a
routine that validates all of the entries to make sure that they make sense
and are consistent with each other. If any aren't, the program displays a
message box and then directs the focus to the offending control. However, if
the control in question is on a different tab to the one that was visible
when the user clicked OK, I can't use the SetFocus method to direct the
focus to it. I think somehow I need to display the tab it is on first and
then set the focus.
So my question is basically, how do I switch between tabs of a multipage
control programatically? I have been through the Excel VBA helpfile which is
not particularly helpful! I have also tried all the obvious combinations I
can think of but without any success.
Would really appreciate any advice anyone could offer.
Regards,
James.
|