Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multipage control on Excel VBA forms
Not very intuitive ...
MultiPage1.Value = 0 'or 1 -- Vasant "James Garner" wrote in message ... 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. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multipage control on Excel VBA forms
Many thanks, Vasant - that does the job perfectly.
You are right though - it would have taken me a while to guess that was the way to do it! Regards, James. "Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message ... Not very intuitive ... MultiPage1.Value = 0 'or 1 -- Vasant "James Garner" wrote in message ... 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Option Buttons, Forms Control, Excel 2007 - 3 options | Excel Worksheet Functions | |||
Difference between a Forms Control verus Active-X Control | Excel Discussion (Misc queries) | |||
Forms Control | Excel Discussion (Misc queries) | |||
MultiPage control | Excel Worksheet Functions | |||
Multipage control | Excel Programming |