Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Tab Order
How can I setup/arrange the tab order for text box objects? I have tried
every setting in the properties box and I can't get the cursor to move from one text box to another without using the mouse. Does anyone have an answer or suggestion for this? Thanks in advance. Mike |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Tab Order
(see comment to your previous question)
Sebastien |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Tab Order
As Sebastion said, not supported if on a worksheet. You can look at this
code posted by Rob Bovey that simulates this type of behavior. http://groups.google.com/groups?thre...gp13.p hx.gbl Hi Todd, The TabOrder property is an inherited property. That means it comes from the container that a control is situated in. A UserForm supplies this property, a worksheet doesn't. You can still tab amongst controls on a worksheet, you just have to code it yourself using each control's KeyDown event procedure. In the sample event procedure below I'll assume a hypothetical situation where we have three textboxes: TextBoxPrevious, TextBoxCurrent, and TextBoxNext. This event procedure shows you how to use VBA to emulate tabbing behavior. Pressing Tab moves from TextBoxCurrent to TextBoxNext and pressing Shift+Tab moves from TextBoxCurrent to TextBoxPrevious. The Up and Down arrow keys and the Enter key are given similar behavior. Private Sub TextBoxCurrent_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _ ByVal Shift As Integer) Dim bBackwards As Boolean Select Case KeyCode ''' These are the only keys we care about. Case vbKeyTab, vbKeyReturn, vbKeyDown, vbKeyUp Application.ScreenUpdating = False ''' Determine if we need to move backwards. bBackwards = CBool(Shift And 1) Or (KeyCode = vbKeyUp) ''' In Excel 97 we must select a cell ''' before activating another control. If Application.Version < 9 Then Sheet1.Range("A1").Select ''' Activate the appropriate control based on key(s) pressed. If bBackwards Then TextBoxPrevious.Activate Else _ TextBoxNext.Activate Application.ScreenUpdating = True End Select End Sub -- Rob Bovey, MCSE, MCSD, Excel MVP Application Professionals http://www.appspro.com/ -- Regards, Tom Ogilvy "MikeS" wrote in message ... How can I setup/arrange the tab order for text box objects? I have tried every setting in the properties box and I can't get the cursor to move from one text box to another without using the mouse. Does anyone have an answer or suggestion for this? Thanks in advance. Mike |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to change series plotting order without changing legend order? | Charts and Charting in Excel | |||
For chart syles, why doesn't color order match series order? | Charts and Charting in Excel | |||
How stop Excel file UK date order changing to US order in m.merge | Excel Discussion (Misc queries) | |||
I want a purchase order that includes page number (if to be order. | New Users to Excel | |||
Daily Macro to Download Data, Order and paste in order | Excel Worksheet Functions |