Use tab key to move between controls on multipage

D

Dale Fye

I've got several multipage controls on a userform.

Unfortunately, I'm having difficulty moving between the controls on the form
using the tab key. I'm trying to minimize the need to use the mouse on this
userform, so I have added some code in the KeyDown event of many of my
controls (the last one on a particular page of a multipage control) to test
for vbKeyTab. If the tab key is encountered, I run some code similar to:

If KeyCode = vbKeyTab Then
Me.tab_Solutions.Value = 1
Me.txt_Type.SetFocus
End If

Generally, when I am moving between controls on different pages within the
same multi-page, (as above) this works just find. However, when I try to
move between multipages, Excel is not responding as I would expect. I would
expect Excel to set the value of the next multipage control to the first tab
(it does this OK), but when I try to set the focus to a control on this
multipage control, Excel seems to lose track of which control should have the
focus.

If KeyCode = vbKeyTab Then
Me.tab_NextMultipage.Value = 0
Me.tab_NextMultipage.SetFocus
Me.cbo_Soln_Type.SetFocus
End If

Any ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top