J
John
Hello group -
I'm trying to populate an Excel spreadsheet with links to bookmarks in
Word. It sort of works, but not perfectly. Sometimes I get the text I
want, other times I get the heading number (e.g. 1.2.2) or just blanks
instead.
For debug, I msgbox the sentence in Word every time I create a bookmark
and it's correct. Please help!
In WORD, I add bookmarks like this:
With Selection 'check size of selection
If .Start = .End Then 'if nothing selected, mark entire sentence
.Sentences(1).Select
.Sentences(1).bookmarks.Add Name:=bookmark_name
Else: 'if something is selected, mark just
selection
.bookmarks.Add Name:=bookmark_name
End If
End With
In EXCEL, I build the link to the bookmark this:
With ActiveSheet.Cells(targetrow, 2)
.Formula = "=" & " Word.Document|'" & filepathname & "'!'!" &
bookmark_name & "'"
.WrapText = True
.Calculate
End With
I'm trying to populate an Excel spreadsheet with links to bookmarks in
Word. It sort of works, but not perfectly. Sometimes I get the text I
want, other times I get the heading number (e.g. 1.2.2) or just blanks
instead.
For debug, I msgbox the sentence in Word every time I create a bookmark
and it's correct. Please help!
In WORD, I add bookmarks like this:
With Selection 'check size of selection
If .Start = .End Then 'if nothing selected, mark entire sentence
.Sentences(1).Select
.Sentences(1).bookmarks.Add Name:=bookmark_name
Else: 'if something is selected, mark just
selection
.bookmarks.Add Name:=bookmark_name
End If
End With
In EXCEL, I build the link to the bookmark this:
With ActiveSheet.Cells(targetrow, 2)
.Formula = "=" & " Word.Document|'" & filepathname & "'!'!" &
bookmark_name & "'"
.WrapText = True
.Calculate
End With