Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
setfocus does not work as expected
I am new to visual basic for applications and I am trying to create a form
(in Excel 2003, Windows XP pro) that provides an interactive script to fill out certain cells in an spreadsheet. Each question (in the form of a label) and space for the answer (textbox or combobox) becomes visible only after the user has answered the preceeding question. This is because the next question may change (or be skipped) depending on the answer to the current question. For some reason the focus is not following the tab order correctly. As an example, I have a textbox followed by a combobox. As the user is typing in the textbox, the combobox remains hidden. Once the user enters the answer, the exit code for the textbox changes the text of the label for the next question and sets the visible property of the label and the combobox to true. The combobox is the next control in the tab order, so I would expect the focus to go from the textbox to the combobox. Instead, it goes back to the first control on the form. Once the combobox is visible, however, tabbing through the controls produces the expected result, so the problem seems to happen only when the combobox is receiving the focus immediately after becoming visible. Similar things happen in several places on the form. I tried using setfocus to 'force' the focus to go to the correct control but it does not work. I also tried putting the code to change the visible property of the combobox in the code for the afterupdate event of the textbox. Nothing worked. Any ideas? Any help will be greatly appreciated! William |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Round doesnt work the way it is expected | Excel Discussion (Misc queries) | |||
setfocus | Excel Programming | |||
How Do I Get SetFocus To Work??? | Excel Programming | |||
SetFocus Problem | Excel Programming |