#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Tab Order

(see comment to your previous question)
Sebastien
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
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
How to change series plotting order without changing legend order? PatrickM Charts and Charting in Excel 6 December 2nd 09 07:43 PM
For chart syles, why doesn't color order match series order? AMiller Charts and Charting in Excel 1 October 29th 09 12:02 AM
How stop Excel file UK date order changing to US order in m.merge Roger Aldridge Excel Discussion (Misc queries) 1 October 9th 07 11:52 PM
I want a purchase order that includes page number (if to be order. Angela New Users to Excel 1 December 3rd 04 04:39 PM
Daily Macro to Download Data, Order and paste in order Iarla Excel Worksheet Functions 1 November 17th 04 01:59 PM


All times are GMT +1. The time now is 12:46 AM.

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"