Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Round doesnt work the way it is expected Carlo Excel Discussion (Misc queries) 13 December 20th 06 11:26 PM
setfocus Dean Reardon Excel Programming 2 December 15th 04 12:18 PM
How Do I Get SetFocus To Work??? Minitman[_4_] Excel Programming 3 November 13th 04 09:18 PM
SetFocus Problem Todd Huttenstine[_2_] Excel Programming 2 January 19th 04 10:50 PM


All times are GMT +1. The time now is 01:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"