tab order / protected form

D

denman

I used the macro from http://word.mvps.org/FAQs/TblsFldsFms/SetTabOrder.htm
and I "think" I used the Forms toolbar to create text boxes and check boxes,
but now the "Protect Form" button is dim and cannot be selected to protect my
form. Do I have to use the Control Toolbox toolbar to create text boxes and
check boxes when using this macro?

Thanks.
 
J

Jay Freedman

denman said:
I used the macro from
http://word.mvps.org/FAQs/TblsFldsFms/SetTabOrder.htm and I "think" I
used the Forms toolbar to create text boxes and check boxes, but now
the "Protect Form" button is dim and cannot be selected to protect my
form. Do I have to use the Control Toolbox toolbar to create text
boxes and check boxes when using this macro?

Thanks.

To answer your last question first, no -- that won't work at all, because
the Control Toolbox controls don't have entry and exit macros in the same
way that Forms controls do. (They have event procedures that could be used
in a similar way, but the programming would be completely different.)

The reason the Protect Form button is inactive is probably that the document
is in Design Mode. That's controlled by a button on the Control Toolbox
(left side of the top row). Turn it off and close the toolbox.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
D

denman

Thanks. That worked, but this brought me to another problem. I didn't get
this far before.

When I try to run the macro it gives me an error of "The macros in this
project are disabled. Please refer to the online help or documentation of
the host application to determine how to enable macros."

I tried to "Run" the macro, "Step Into" the macro, I tried simplying using
the form (tabbing from one tab stop to another) and these all give me the
same error message. Is there something wrong with my code? Sorry for the
ignorance, I'm new to macros.
 
J

Jay Freedman

Two things to check:

- Is the form (and its macros) stored as a template (*.dot file) or as a
document (*.doc file)? If it's a template, is it stored in the folder chosen
as the User Templates folder in Tools > Options > File Locations?

- What is the setting of the macro security level in Tools > Macro >
Security?

The macro security mechanism in Word considers macros in document files and
in templates that aren't in the User Templates location to be possible
viruses. If the security level is set any higher than Medium, the macros
will be disabled.
 
D

denman

The security setting was the problem, thanks, but as before this now brings
me to a new problem. I have worked on this several times over the last few
days (sorry for not replying before now) and I can't get it to tab correctly
through the form. I have actually tried 2 different macos: one from:
http://word.mvps.org/FAQs/TblsFldsFms/SetTabOrder.htm
and the other from:
http://support.microsoft.com/kb/212378/en-us
In both cases, I tried using the code for using the single exit macro in all
form fields. The problem is that it will tab through some correctly but not
others. I am using both text boxes and check boxes.

You're a great help. Any ideas to get me going with this problem?

Thanks.
 
J

Jay Freedman

There are so many ways this form and its code could be set up wrong, and
your description is so unspecific, that I'm not sure where to start.

I'll assume your code is written correctly, meaning that it doesn't stop
with a syntax error or a runtime error.

I strongly recommend that you use the code from the SetTabOrder.htm page
(the page explains why it's different from the one in the KnowledgeBase).

The field/bookmark names in the code must match the actual names in the
form, except that upper/lower case doesn't matter. Check every Case
statement to be sure. Also, you can add one more case just before the End
Select statement:

Case Else ' no match
MsgBox "No case for field named " & StrCurFFld

If this message appears when you tab through the form, you've found one that
you forgot to write code for.

If you go through that exercise and you still have trouble, email a copy of
the form to me along with an explanation of which fields aren't working and
where you want the cursor to go when you tab out of them. You can find my
address at http://jay-freedman.info/contact/contact.htm.
 
D

denman

The code you had me add in your previous message did help me find a couple of
run time errors that I didn't know I had, but it didn't fix the main problem.
I also did go back and double check the code and didn't see anything wrong.
It will tab correctly through portions that I'm not using the macro and it
will tab correctly through sections where I have text boxes and need the
macro, but it will not work correctly in the section where I use a mixture of
check boxes (primarily) with a few text boxes mixed in. I will email it to
you as you suggested.

Thanks,
denman
 
J

Jay Freedman

The problem is resolved. The code in the article
http://word.mvps.org/FAQs/TblsFldsFms/SetTabOrder.htm uses a line

ActiveDocument.Bookmarks(StrFFldToGoTo).Range.Fields(1).Result.Select

to select the desired form field, but it works properly only for text form
fields. When the desired form field is a check box, this has to be used instead:

ActiveDocument.Bookmarks(StrFFldToGoTo).Range.Select
 
D

denman

The IF statement in your email worked like a charm. Thanks for the help, you
are greatly appreciated. If you have influence, you should get the site
(http://word.mvps.org/FAQs/TblsFldsFms/SetTabOrder.htm) updated to include
this addition (along with the needed code for dropdowns). That would be
really helpful. And since I'm leaving a wish list, it would be awesome if
there was a way to make the macro accept mouse input to change positions and
"Shift+Tab" to reverse the order when desired. But maybe I'm dreaming.
Anyway, udaman!!!
 

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