Solved

Hyperlink to a Word Document

Posted on 2006-07-11
5
415 Views
Last Modified: 2012-06-27
I am working in Access 97:

I have a help manual in Word for my database.  I would like to add a button to a form and when it is clicked, have it go to a specific page of the Word document.   Can I use the hyperlink feature?

Thanks for your help.

S
0
Comment
Question by:Sasha42
  • 3
5 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 17082365
unless u have some sort of macro in your word doc, try this
Bit of word automation Im afraid


Public Sub OpenWordDoc()

    Dim objWord As Object
   
    Set objWord = CreateObject("Word.Application")

'Open doc c:\mydoc.doc
    objWord.Documents.Open "C:\mydoc.doc"

'goto page 2
    objWord.Selection.GoTo What:=wdGoToPage, Which:=wdGoToFirst, Count:=2, name:=""
    objWord.Visible = True
   
End Sub


0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17082626
I just tried that code and it went straight to page 2

0
 

Author Comment

by:Sasha42
ID: 17082855
Thanks for your help.

I get a variable not defined error at: =wdGoToPage
0
 
LVL 39

Accepted Solution

by:
stevbe earned 250 total points
ID: 17083784
building upon the shoulders of a giant ...

if you want a specific named bookmark then ...

to stop the undefined variable you can either set a refernece to Word or define wdGoToBookmark = -1

Private Sub cmdHelpAddNewClient_Click()

Dim objWord As Object
Dim wdGoToBookmark As Long
   
    Set objWord = CreateObject("Word.Application")
    wdGoToBookmark = -1

    'Open doc c:\mydoc.doc
    objWord.Documents.Open "C:\mydoc.doc"

    'goto a named bookmark
    objWord.Selection.GoTo What:=wdGoToBookmark, Name:="Add Client"
    objWord.Visible = True

End Sub

Steve
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17085537
bah,
Sasha42, sorry for the late response. I was at work for a while but I left before u posted
And had guests today!

But I see u are using a bookmark method now

for your info

wdGoToPage is equvalent to 1
wdGoToFirst is also equivalent to 1

change them to 1 and see if it works for you
I would be interested to know
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question