View Single Post
Old 07-12-2010, 03:21 AM   #4
nomesque
Snooty Bestselling Author
nomesque ought to be getting tired of karma fortunes by now.nomesque ought to be getting tired of karma fortunes by now.nomesque ought to be getting tired of karma fortunes by now.nomesque ought to be getting tired of karma fortunes by now.nomesque ought to be getting tired of karma fortunes by now.nomesque ought to be getting tired of karma fortunes by now.nomesque ought to be getting tired of karma fortunes by now.nomesque ought to be getting tired of karma fortunes by now.nomesque ought to be getting tired of karma fortunes by now.nomesque ought to be getting tired of karma fortunes by now.nomesque ought to be getting tired of karma fortunes by now.
 
nomesque's Avatar
 
Posts: 1,485
Karma: 1000000
Join Date: Aug 2009
Location: Ipswich, QLD, Australia
Device: PRS-650
You COULD probably do that in VBA. You'd need a loop which goes through the text searching for a 16pt-formatted character, highlights the whole word/paragraph, inserts a bookmark of the same name (replacing spaces with underscores, perhaps), then searches for text strings matching that bookmarked string, and adds a bookmark reference to each one of them.

Here's a start (because once I started talking about it, I had to see if it would actually work):

Quote:
Sub SearchNBookmark()

Selection.Find.ClearFormatting
With Selection.Find
.Forward = True
.Wrap = wdFindContinue
.Format = True
.Font.Size = 16
End With
Selection.Find.Execute
Selection.Copy
With ActiveDocument.Bookmarks
.Add Range:=Selection.Range, Name:="Blah_blah_blah"
.DefaultSorting = wdSortByName
.ShowHidden = False
End With
With ActiveDocument.Bookmarks
.DefaultSorting = wdSortByLocation
.ShowHidden = False
End With
Selection.Find.ClearFormatting
With Selection.Find
.Text = "Blah blah blah"
.Forward = True
.Wrap = wdFindContinue
.Format = False
End With
Selection.Find.Execute
Selection.InsertCrossReference ReferenceType:="Bookmark", ReferenceKind:= _
wdContentText, ReferenceItem:="Blah_blah_blah", InsertAsHyperlink:=True, _
IncludePosition:=False, SeparateNumbers:=False, SeparatorString:=" "
End Sub
nomesque is offline   Reply With Quote