I want to open a specified document, check whether the hidden bookmark
_Toc69698351 exists
If it exists append the bookmark name to a string as part of a hyperlink
If it does not exist check whether the non hidden bookmark "KeyFindings"
exists
If this exists append it to the document filename as the sub-address of the
document
If it doesn't exist find the words "Key Findings" as the full text of a
paragraph and make this a new bookmark.

The answer to CowGirl partly answers the question but first I need to open
the document. Here is what I have so far:

Dim appWord As Word.Application
Dim wrdDoc As Word.Document
Dim wrdBookmark As Word.Bookmark

Set appWord = CreateObject("Word.Application")
appWord.Documents.Add
appWord.Documents.Open (sFile)

On Error Resume Next
wrdDoc.Bookmarks("_Toc69698351").Select
If Err Then
'The bookmark was not found
On Error Resume Next
wrdDoc.Bookmarks("KeyFindings").Select
If Err Then
'Can we find the heading
wrdDoc.Content.Find.Execute "Key Findings", False, True
???
Else
gsKeyFindings = sFile & "#KeyFindings"
End If
Else
gsKeyFindings = sFile & "#_Toc69698351"
End If
End If
The Word document is not opening correctly
TIA
Terry

Re: Working with bookmarks by Doug

Doug
Wed Dec 08 19:38:03 CST 2004

Use

Dim appWord As Word.Application
Dim wrdDoc As Word.Document
Dim wrdBookmark As Word.Bookmark

Set appWord = CreateObject("Word.Application")
Set wrdDoc = appWord.Documents.Open (sFile)


--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
"Terry" <Terry@discussions.microsoft.com> wrote in message
news:8BFACB29-7E8C-493D-B6BC-4866E7E21397@microsoft.com...
>I want to open a specified document, check whether the hidden bookmark
> _Toc69698351 exists
> If it exists append the bookmark name to a string as part of a hyperlink
> If it does not exist check whether the non hidden bookmark "KeyFindings"
> exists
> If this exists append it to the document filename as the sub-address of
> the
> document
> If it doesn't exist find the words "Key Findings" as the full text of a
> paragraph and make this a new bookmark.
>
> The answer to CowGirl partly answers the question but first I need to open
> the document. Here is what I have so far:
>
> Dim appWord As Word.Application
> Dim wrdDoc As Word.Document
> Dim wrdBookmark As Word.Bookmark
>
> Set appWord = CreateObject("Word.Application")
> appWord.Documents.Add
> appWord.Documents.Open (sFile)
>
> On Error Resume Next
> wrdDoc.Bookmarks("_Toc69698351").Select
> If Err Then
> 'The bookmark was not found
> On Error Resume Next
> wrdDoc.Bookmarks("KeyFindings").Select
> If Err Then
> 'Can we find the heading
> wrdDoc.Content.Find.Execute "Key Findings", False, True
> ???
> Else
> gsKeyFindings = sFile & "#KeyFindings"
> End If
> Else
> gsKeyFindings = sFile & "#_Toc69698351"
> End If
> End If
> The Word document is not opening correctly
> TIA
> Terry