Tabs on Form

W

Weste

I have a Word 2002 form. I have used the controls from the Visual Basic
toolbox vs form fields becuase I needed more robust controls, eg multi-column
combo boxes. The controls are within a table in the Word document. In the
KeyDown event for each control I have placed the code to allow users to tab
thru the controls. See example below.

If KeyCode = vbKeyTab Then
me.txtRequestorExt.Select
End If

This code works fine as long as the form is not protected. However, once I
protect the form, pressing tab no longer selects the correct control.

I have also tried unprotecting the doc before selecting the code and then
protecting the doc again after the selection is made.

If KeyCode = vbKeyTab Then
Me.Unprotect
Me.txtRequestorExt.Select
Me.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End If

Using this method the cursor moves to the correct control until the
protection is turned back on. The cursor then jumps to the next control.

Is there anything I can do to have protection turned on and tab thru my
controls? Thanks for your help.

Weste
 
C

Cooz

Hi Weste,

No, alas, there is not. When a document is protected for form fields, only
form fields can be accessed.

I think what you really want is create a form in VBA that holds your
controls and fills in the document when the user presses OK (like any other
dialog in Word). It is a little far-fetched to get into the details of this
here, but that may be something that can help you out.

Success,
Cooz
 

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