Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / September 2006

Tip: Looking for answers? Try searching our database.

bookmark macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jb914 - 10 Sep 2006 08:52 GMT
i have a VBA addin for word that will fill in multiple bookmarks in a
document.  So, if i have bookmarks in a document bkName, bkName1, bkName2,
ect.......throughout the document the program will fill in the name in the
right spot.  it simply looks for a new

My users are novices.  i am trying to build them a toolbar to simplify the
process.

i have the toolbar built which includes a bunch of buttons using code like:

Sub bkName()
   With ActiveDocument.Bookmarks
       .Add Range:=Selection.Range, Name:="bkName"
       .DefaultSorting = wdSortByName
       .ShowHidden = False
   End With
End Sub

I know the program uses the following code to loop thru filling in the
bookmarks

Private Sub SetBookmarkText(doc As Document, ByVal Name As String, ByVal
Value As String)
   On Error Resume Next
   With doc
   .Bookmarks(Name).Range.Text = Value
       Dim i As Integer
       i = 1
       Do While .Bookmarks.Exists(Name & CStr(i))
           .Bookmarks(Name & CStr(i)).Range.Text = Value
           i = i + 1
       Loop
   End With
End Sub

How would i modify the bookmark creation code to check for an existing
bookmark and LOOP thru to create them?  So, if bkName is already in the
document it will insert a bookmark bkName1  and if bkName1 is already in it
will do bkName2

any direction would be appreciated.

thanks

JB
Russ - 10 Sep 2006 09:38 GMT
Joe,
See an answer in .general newsgroup. You should not post the same question
to multiple word.vba newsgroups.

> i have a VBA addin for word that will fill in multiple bookmarks in a
> document.  So, if i have bookmarks in a document bkName, bkName1, bkName2,
[quoted text clipped - 41 lines]
>
> JB

Signature

Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.