
Signature
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
I have considered doing this before, but it also gives me some problems.
Using the Rich Text in the developer panel (to the left of "text") allows me
to insert rich text (that seems to work just like normal text in word) that
gives me access to locking and tagging it. However it does not gives buttons,
drop downs etc access to additional properties such as .Visible, .Value,
.Text etc.
Using the ActiveX Controls menu and inserting Microsoft Rich TextBox
Control, Version 6.0 also generates and error that the program used to create
the control is no longer available. ( I assume it requires Visual basic to be
installed, which is another problem since everyone who will edit certain
parts of this file will not have VB installed).
Any alternatives? (word 2007 or 2003, any version)
> Because you've specified Word 2007, you have a solution that's available
> only there (or in versions back to Word 2000 using the Compatibility Pack):
[quoted text clipped - 41 lines]
> >
> > Ryan
Ryan - 09 Feb 2007 19:02 GMT
Basically to clarify a little more lets try this:
This is a sample document that would feature the functionality I'm looking
for.
<img src="http://www.geocities.com/cs_gfw/1.JPG">
Here we have a list of items in a Rich Text format from the developer menu,
and can still be edited by your normal word user (does not need to code
anything).
I would like to be able to use the button to hide such text similar to this:
<img src="http://www.geocities.com/cs_gfw/2.JPG">
But since this rich text cannot be assigned a NAME, this will not work.
If there is a way to do it, it should yield a result such as:
<img src="http://www.geocities.com/cs_gfw/3.JPG">
- Ryan
> I have considered doing this before, but it also gives me some problems.
>
[quoted text clipped - 57 lines]
> > >
> > > Ryan
Jay Freedman - 10 Feb 2007 04:51 GMT
Content controls do let you manipulate their visibility, text, and so
forth, but the syntax is a bit different from the old controls.
Unless I'm missing something (a good possibility), you can't address a
content control directly by its .Title, .Tag, or .ID property, only by
its index within the document, and that may change as the document is
edited. That means the only reliable way to address a particular
control is to iterate through the collection, checking each one's .Tag
or .ID (the .Title isn't unique, and the .Tag is unique only if you
assign them that way) until you find the one you want.
To toggle a content control's visibility, you can do something like
this:
Dim cc As ContentControl
For Each cc In ActiveDocument.ContentControls
If cc.Tag = "rt1" Then
cc.Range.Font.Hidden = Not cc.Range.Font.Hidden
Exit For
End If
Next
There is no .Value property; instead you use cc.Range.Text. This is
true for dropdowns and combo boxes just as for text controls.
To change a dropdown's value, you can use something like this:
Dim cc As ContentControl
For Each cc In ActiveDocument.ContentControls
If cc.Type = wdContentControlDropdownList And _
cc.Tag = "dd1" Then
cc.DropdownListEntries(3).Select
Exit For
End If
Next
(If you try to access the .DropDownListEntries property for a content
control that isn't a dropdown or a combo box, you'll get an error.)
I would avoid ActiveX controls like the plague. They're far more
trouble than they're worth. See
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnword2k2/html/
odc_activeX.asp
for details of the ones that are available within Word. If you import
VB controls such as the Rich Text Box, you'll need the development
license to be able to put them in, and then you'll have to distribute
the .dll or .ocx that contains them (but other users don't have to
have VB, just the distributed file).
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
>I have considered doing this before, but it also gives me some problems.
>
[quoted text clipped - 57 lines]
>> >
>> > Ryan