How to send user to a particular part of a Word document fromAccess/Excel?

C

Chrisso

Hi All

I have a manuals for my systems in Word. At various places around my
Access and Excel systems I would like to place help icons - when the
user clicks these my VB will not only open the document but open it to
the correct heading/page that discusses the feature near the help icon
pressed.

I have found on these boards code to open the Word document. Does
anyone know the VB for then setting the users screen to a particular
part of the document? I have not tried any Word VB programming yet so
I am hoping someone out there has this sort of code lying around.

Cheers for any help,

Chrisso
 
H

Helmut Weber

Hi Chrisso,

you may just search for specific text,
maybe plus specific formatting.

Can be recorded easily, though,
what the macro recorder records, isn't very elegant,
but might give valuable hints, what properties
the find-object provides.

Try something like that:

Sub TestA()
Dim rDcm As Range
Set rDcm = ActiveDocument.Range
With rDcm.Find
.Text = "fix"
If Not .Execute Then
MsgBox """fix""" & " was not found"
Else
rDcm.Select
End If
End With
End Sub

Or goto a specific page, like that:

Sub Test9987()
Selection.GoTo _
what:=wdGoToPage, _
which:=wdGoToAbsolute, _
Count:=18
End Sub

By the way, using PDFs as help
might be a better idea anyway.



--

Gruß

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 
C

Chrisso

Thanks Helmut

That will do nicely. I did not realise you can record macros in Word
like Excel. Excellent.

Chrisso
 
F

fumei via OfficeKB.com

Not sure what form these icons are. But if they are hyperlinks, you can
easily have them open the Word document, and make it go directly to a
bookmark. For example, In Excel:

Insert a hyperlink, and make the address:

C:\MyFiles\Test\MyFileName.doc#ComeHere

Clicking the hyperlink will open the Word document C:\MyFiles\Test\MyFileName.
doc, and move the Selection to the bookmark ComeHere (no matter where it is).
 

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