Tab order quits working in a userform

JohnHolliday

New Member
Joined
Mar 3, 2015
Messages
2
I have created an automated spreadsheet to act as a log for any faxes our company receives. The userform I created to enter the information contains five text boxes and two check boxes. There are three command buttons: Finish, Submit/Continue, and Cancel. When someone enters the information from a single fax they just press the Finish button. If there are multiple faxes the person would enter the data and click on Submit/Continue,which logs the data and refreshes the userform, until the last fax is reached and they would then click the Finish button. The VBA code to store the data into the sheet runs each time either the Finish or Submit/Continue button is clicked.

The problem I am having is that while the tab order works perfectly the first time around, on the second and subsequent passes, the tab button no longer works as expected. That is, it will merely add tab spacing to the text in the text box rather than move between text boxes as it should. Shift-Tab also stops working. This was not a problem at first but is has appeared recently. As long as Submit/Continue is clicked, the data is logged to the sheet and the userform is cleared for more input.

Since I wrote this after my company released the December 2014 update, I don't see how that could be the problem. I do not have local admin authority anyway and I cannot apply those fixes.

The file is stored on a server were multiple people can access it, one at a time. I copy the file to my local computer at the end of each day as an additional backup to the server backup. The local copy always works fine and I'm not sure why placing it on a server would make a difference. The macro content must be enabled each time the file is opened because I cannot enter a server path into my trusted locations per policy. When I tested this locally in a non-trusted location, the tab order functionality worked fine.

Anyone have any ideas? I'm stuck!
 
Not certain the cause but a fix would be to make sure the textboxes and the buttons have the desired TabIndex, TabKeyBehavior, and TabStop -- you can set this every time the user presses one of the 3 buttons.
 
Upvote 0
@Roderick_E - You sir, are a gentleman and a scholar. Simple and elegant fix. I just added Userform1.TextBox1.TabKeyBehavior = False to my form cleanup sub and it works great. You're the boss! Thanks!
 
Upvote 0
I know this is an old thread, but I came up with this piece of code to perform a similar operation on a large userform.
VBA Code:
Private Sub SeTTaBS()
'loop through the controls and set tab key behaviour.
    Dim ctlBox As MSForms.Control
    
    For Each ctlBox In Me.Controls
        If TypeName(ctlBox) = "TextBox" Then
            ctlBox.TabKeyBehavior = False
        End If
    Next ctlBox

End Sub
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top