Unvisible Text / property

P

Peter Lingo

Hello,

I have a vba application for word, in which it is nesessary to put
information (=text) in the document which is unvisible for the user. Is
there any property were this can be done?
thanks Peter
 
S

Stan Scott

Yes. If you do it from the document itself, you select the text, click
Format and then check the "Hidden" checkbox on the dialog. If you do it
from code, use Selection.Font.Hidden = True
 
D

Doug Robbins

Hi Peter,

The following will insert some text and format the font as hidden

Dim myrange As Range
Set myrange = Selection.Range
myrange.Text = "Some Text"
myrange.Font.Hidden = True

The user can easily see it however if they turn on the display of hidden
text. Using a DocumentVariable would allow you to save some text with the
document so that:

You could later retrieve if by

Using VBA
Inserting a DocVariable field

Even then however, all that the user would have to do is run the following
code to learn what the text is:

Dim avar As Variable
For Each avar In ActiveDocument.Variables
MsgBox avar.Value
Next avar

--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
 
P

Peter

Stan Scott said:
Yes. If you do it from the document itself, you select the text, click
Format and then check the "Hidden" checkbox on the dialog. If you do it
from code, use Selection.Font.Hidden = True

Can it make be sure that the user can't made the hidden text visible?
Even when the rest of document is editable completly
(format/content...)?

Thanks Peter
 
D

Doug Robbins

If it's in the document, the user can read it.

--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
 
C

Chad DeMeyer

If you store the information in document variables, it will be accessible to
users but the average user doesn't know what they are or how to access them.
They can only be read by inserting a DOCVARIABLE field in the document or
using VBA.

Regards,
Chad
 
P

Peter

Chad DeMeyer said:
If you store the information in document variables, it will be accessible to
users but the average user doesn't know what they are or how to access them.
They can only be read by inserting a DOCVARIABLE field in the document or
using VBA.

Regards,
Chad

Thanks for the suggestions, DOCVARIABLE works like I want

Peter
 
C

Chad DeMeyer

Glad to be of assistance
Regards,
Chad


Peter said:
"Chad DeMeyer" <cjdemeye at bechtel dot com> wrote in message

Thanks for the suggestions, DOCVARIABLE works like I want

Peter
 
P

Peter

Chad DeMeyer said:
Glad to be of assistance
Regards,
Chad

one further quetions

there is the method activedocument.variables.add
but why is not the activedocument.variables.remove method available?

thanks Peter
 
J

Jay Freedman

one further quetions

there is the method activedocument.variables.add
but why is not the activedocument.variables.remove method available?

thanks Peter

The folks who wrote the architecture of VBA decided that collections
don't have a .Remove method. Instead, the objects in the collection
have a .Delete method. Thus, you would call

ActiveDocument.Variables("myVar").Delete

to remove the variable named myVar.

Of course, nothing in MS software is completely logical, so there are
exceptions: the Controls, Pages, and Tabs collections do have a
..Remove method. <shrug>
 

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