I am trying to automate word from Access and I can't seem to get the syntax
correct for referencing a bookmark in the header.
WordApp.Selection.GoTo What:=wdGoToBookmark, Name:="CycleName"
WordApp.Selection.TypeText Text:=rsDAO!CycleName
works fine in the body of the document but can't "see" bookmarks in the
header. So I tried:
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
WordApp.Selection.GoTo What:=wdGoToBookmark, Name:="CycleName"
WordApp.Selection.TypeText Text:=rsDAO!CycleName
But that didn't work either. I still got the "Word cannot find the
requested bookmark" message.
Can someone point me in the right direction?
Pat Hartman (MVP) - 27 Apr 2006 15:59 GMT
Thanks anyway. I found a solution:
Dim rng As Word.Range
Dim bkm As String
bkm = "Cycle"
Set rng = WordDoc.Bookmarks(bkm).Range
rng.Text = rsDAO!CycleRoman
WordDoc.Bookmarks.Add bkm, rng
> I am trying to automate word from Access and I can't seem to get the syntax
> correct for referencing a bookmark in the header.
[quoted text clipped - 12 lines]
>
> Can someone point me in the right direction?