ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Use tab key to move between controls on multipage (https://www.excelbanter.com/excel-programming/399343-use-tab-key-move-between-controls-multipage.html)

Dale Fye

Use tab key to move between controls on multipage
 
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?

--
Email address is not valid.
Please reply to newsgroup only.


All times are GMT +1. The time now is 02:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com