Naming sentences

  • Thread starter Thread starter Brad
  • Start date Start date
B

Brad

Can you "name" a sentence? If so, how is this done?

What I'm trying to do is to control what is being printed out in a document
and would like to be able to hide sentences and/or paragraphs. (Most likely
using VBA, of which I have some experience, which is more than what I can say
for using Word?
 
Hi Brad,
Can you "name" a sentence? If so, how is this done?
What I'm trying to do is to control what is being printed out in a document
and would like to be able to hide sentences and/or paragraphs. (Most likely
using VBA, of which I have some experience, which is more than what I can say
for using Word?

???

Maybe like that:

Sub Macro1()
Dim This As Range
Set This = ActiveDocument.Range.Sentences(3)
This.Font.Hidden = True
' ...
End Sub

But linguistic concepts like sentence and word are fuzzy,
and hiding ActiveDocument.Range.Sentences(3) does just the same.
So there is nothing gained.
 
Your suggestion worked - thank you. However, can I replace the (3) with a
"name"? That would be "marked" at the beginning and the end (in this case a
sentence, but could be a paragraph or a few words) so that no matter where it
is I can hide it.
 
Hi Brad,
Your suggestion worked - thank you. However, can I replace the (3) with a
"name"? That would be "marked" at the beginning and the end (in this case a
sentence, but could be a paragraph or a few words) so that no matter where it
is I can hide it.

hmm, I think you are looking for bookmarks.
From the user interface, select some text.
Sentence, paragraph, a few words, whatsoever.
On the menu bar, choose "Insert bookmark",
give it a name, and select "add".
From then on you got a named range.

Then, like that:

ActiveDocument.Bookmarks("Test").Range.Font.Hidden = True
--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 
Thank you, from the Mid West


Helmut Weber said:
Hi Brad,


hmm, I think you are looking for bookmarks.
From the user interface, select some text.
Sentence, paragraph, a few words, whatsoever.
On the menu bar, choose "Insert bookmark",
give it a name, and select "add".
From then on you got a named range.

Then, like that:

ActiveDocument.Bookmarks("Test").Range.Font.Hidden = True
--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 
Back
Top