Word bookmark name from Access

C

CNutsch

I am trying to reference a bookmark name in Word 2002 from an Access macro.
When I reference the .Name property I get "OLE_LINK1" as the name and not the
name of the bookmark. I've read lots and can't seem to figure this one out.
Here's my code.

Private Sub Topic00()

Dim myapp As Word.Application
Dim mydoc As Word.Document
Dim mymark As Word.Bookmark
Dim myrange As Word.Range
Dim filedir As String, workingdir As String, topic As String, myname As String

filedir = "E:\Filings for Processing\"
workingdir = "E:\CommentTopics\"

Set myapp = New Word.Application
myapp.Visible = True

'open the file
Set mydoc = myapp.Documents.Open(filedir & "\" & myname, False, True, False)

'loop thru bookmarks
For Each mymark In mydoc.Bookmarks

'mymark.Name returns OLE_LINK1
'I need the bookmark name which would start with "Topic00" in my case
If Left(mymark.Name, 7) = "Topic00" Then
'doing some stuff here
End If
Next

'close the file
mydoc.Close SaveChanges:=False

End Sub
 
C

CNutsch

I figured it out. There were some unexpected bookmarks in a file I had
called "OLE_LINK1" and "OLE_LINK2". It's returning the name correctly. Can
you shed any light on those bookmarks in 20 words or less?

Sorry for the false alarm.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top