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
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