Hi Iain,
Given the purpose - hide certain sections - I might approach
this differently.
1. You wouldn't need to use ActiveX controls - you could use
form field controls, or, if forms protection is too
restrictive, macrobuttonfields that display a checkbox.
(Take a look at how the FAX templates that MS supplies with
Word do their checkboxes)
This would mean you could use many more checkboxes in the
one document, as neither form fields nor macro buttons have
any where near the same overhead as ActiveX controls.
2. In any case, you should be able to wangle a way to use
only one macro for all the checkboxes. If you used a form
field, for example, and bookmarked the ranges, you could
make the formfield name include the bookmark name, so that
you could derive it. Or, if the checkboxes always stand in a
particular relationship to the ranges that are to be hidden,
use that positional relationship (next paragraph, for
example). Or if you use the styles route (described below),
you could format that checkbox with a "matching" style name.
3. You might also consider formatting each of these ranges
with a particular style(name) and changing the definition of
the style to use "hidden" font (or not). That might be
faster than working on a Range object.
Note: I have no idea of the meaning of the particular items
in the field code. I'm pretty sure the 1 has something to do
with the internal class of the control. No idea about /s.
Hi Cindy, thanks for your help. I've cut the number of
checkboxes down to 50 by cutting the document into 10,
and I've updated to Office SP3. It no longer renames the
controls, it doesn't even "create" them, by which I mean
that they remain unusable, with no properties assigned to
them, when the document is opened. They are there to be
seen but they aren't able to be clicked. It was working
fine (fully functional) before I closed the document. Do
you know any way to get around this?
Note: The purpose of the checkboxes in this document is
to hide certain sections of the document when we don't
need to print them, using the .range.font.hidden=true
property. In the procedure view in the visual basic
editor, there are many Private Sub procedures. Can these
be referenced and run by a form field checkbox, or would
I have to create simple macros to run them?
Also, I just clicked the "View Field Codes" button on one
of my toolbars, and it displays every checkbox like this:
{ CONTROL Forms.CheckBox.1 /s }
If I were to change the number 1 to the number I want the
checkbox to have, would that solve my problem, or does
the number 1 signify the type of checkbox? Just out of
curiousity, what does the "/s" do?
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jan
24 2003)
http://www.mvps.org/word
This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail