Solved

Hyperlink to a Word Document

Posted on 2006-07-11
5
413 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now