How do I insert a bookmark into a specific position in a paragraph

V

vincent

How do I insert a bookmark into a specific position in a paragraph?
For example, there is a sentence below and how to I insert a book between
"simple" and "test".

"This is a simple test."

Many thanks for your replying.
 
H

Helmut Weber

Hi Vincent,

the question is often more a problem than the answer.

This should do, what you asked for,
probably not what you want.

Sub Test09()
Dim rTmp As Range
Set rTmp = Selection.Paragraphs(1).Range
With rTmp.Find
.Text = "simple test"
If .Execute Then
.Text = " "
If .Execute Then
rTmp.Bookmarks.Add Name:="Test"
End If
End If
End With
End Sub

However, it might you give an idea
of how to approach the problem.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
H

Helmut Weber

Hi Vincent,

I don't know much about C#,
but according to what I know,
you would need the VBA code anyway,
or parts of it,
embedded in this or that way in the C#-code.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
V

vincent

Many thanks for your replying.
I will try to find some example code on the Internet.
 
L

Linda Fiske

Forgive me if your question is more complicated than this and I have
misunderstood .
Highlight the space between the two words "simple" and "test".
On the top toolbar, click "Insert"
Click "Bookmark" in the dropdown menu.
Give the bookmark a name and click Add.
 
V

vincent

I need c# codes.
Thank you for replying.

Linda Fiske said:
Forgive me if your question is more complicated than this and I have
misunderstood .
Highlight the space between the two words "simple" and "test".
On the top toolbar, click "Insert"
Click "Bookmark" in the dropdown menu.
Give the bookmark a name and click Add.
 

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