Opening Word document from Access - goto bookmark

J

Jen

Hello. I am trying to open a document from Access, and
have a bookmark on my table of contents page. I would
like to open to that bookmark but my code doesn't seem to
work. My code does open the document, just doesn't go to
the bookmark. Anyone see any obvious problems?


Dim WordObj As Word.Application
Dim WordDoc As Word.Document
Dim WordRange As Word.Range
Set WordObj = CreateObject("Word.Application")
Set WordDoc = WordObj.Documents.Open
("N:\Dats\DatsDQ\DQ Instructions.doc")


WordObj.Visible = True


'Go to bookmark named TableofContents
Set WordRange = WordDoc.GoTo(What:=wdGoToBookmark,
Name:="TableofContents")


Thank you in advance,
Jen
 
H

Harold Kless[MSFT}

Jen,
Try this
Set WordRange = WordDoc.bookmarks("TableofContents").range

But you say you want to go to the book. In that case you could simply say
Worddoc.bookmarks("TableofContents").select


Harold Kless, MCSD
Support Professional
Microsoft Technical Support for Business Applications
(e-mail address removed)

--


This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.
 

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