N
Narayana Reddy Bommu
Hai,
I am looking for bookmarks to be existed even after their text is
auto-inserted. I have the bookmark insert function in this way.
Public Sub BM(NameOfBookmark As String, TextToInsert As Variant)
'this sub handles the insertion text into bookmarks
Dim Bookmark As String
Bookmark = NameOfBookmark
If ActiveDocument.Bookmarks.Exists(NameOfBookmark) Then
ActiveDocument.Bookmarks(NameOfBookmark).Range.Text = TextToInsert
Else
Call BMError(NameOfBookmark)
End If
End Sub
Now the problem is that the bookmark (let's say AgreementDay as
NameOfBookmark) is available in the Microsoft Menu of File-> Insert->
Bookmark options. Once the AgreementDay text is inserted by this call
function, i am not able to see that particular NameOfBookmark again in the
menu of File-> Insert-> Bookmark options. I need the bookmark to exist with
the same name after inserting text as well in the bookmarks list. I tried to
modify the above function in this manner.
Public Sub BM(NameOfBookmark As String, TextToInsert As Variant)
'this sub handles the insertion text into bookmarks
Dim Bookmark As String
Bookmark = NameOfBookmark
If ActiveDocument.Bookmarks.Exists(NameOfBookmark) Then
ActiveDocument.Bookmarks(NameOfBookmark).Range.Text = TextToInsert
ActiveDocument.Bookmarks.Add Range:=Selection.Range, Name:="Bookmark"
Else
Call BMError(NameOfBookmark)
End If
End Sub
But, it is not giving the required result. Can anyone help immediately?
I am looking for bookmarks to be existed even after their text is
auto-inserted. I have the bookmark insert function in this way.
Public Sub BM(NameOfBookmark As String, TextToInsert As Variant)
'this sub handles the insertion text into bookmarks
Dim Bookmark As String
Bookmark = NameOfBookmark
If ActiveDocument.Bookmarks.Exists(NameOfBookmark) Then
ActiveDocument.Bookmarks(NameOfBookmark).Range.Text = TextToInsert
Else
Call BMError(NameOfBookmark)
End If
End Sub
Now the problem is that the bookmark (let's say AgreementDay as
NameOfBookmark) is available in the Microsoft Menu of File-> Insert->
Bookmark options. Once the AgreementDay text is inserted by this call
function, i am not able to see that particular NameOfBookmark again in the
menu of File-> Insert-> Bookmark options. I need the bookmark to exist with
the same name after inserting text as well in the bookmarks list. I tried to
modify the above function in this manner.
Public Sub BM(NameOfBookmark As String, TextToInsert As Variant)
'this sub handles the insertion text into bookmarks
Dim Bookmark As String
Bookmark = NameOfBookmark
If ActiveDocument.Bookmarks.Exists(NameOfBookmark) Then
ActiveDocument.Bookmarks(NameOfBookmark).Range.Text = TextToInsert
ActiveDocument.Bookmarks.Add Range:=Selection.Range, Name:="Bookmark"
Else
Call BMError(NameOfBookmark)
End If
End Sub
But, it is not giving the required result. Can anyone help immediately?