How to open a web page with a Word macro/VBA

A

Alain + Ivy

In a Word XP form (the main document) , when the cursor reaches a specific
field, I want to open a Web page
and when the cursor reach another specific field, I want to open another
Word document or template located in the same sub-directory than the main
document.

I am looking for the proper code to open each one individually. Any help is
welcome. thanks a lot

Alain Kadlec
Ottawa
 
G

Greg Maxey

Something like:

Sub Macro1()

ActiveDocument.FollowHyperlink ("http://www.yahoo.com")

End Sub

Sub Macro2()
ActiveDocument.FollowHyperlink ("D:\My Documents\Word
Documents\Recipes\Waffles.doc")

End Sub

Set the macros to run on entry to the specific form fields.
 
A

Alain + Ivy

Thanks a lot Greg. Both macros work very well.
The macro wich open another Word document is very usful but to create a new
document from a template it does not word because it opens the template
itself.

ActiveDocument.FollowHyperlink ("D:\My Documents\Word
Documents\Recipes\Waffles.dot") will open the template instead openning a
new blank document. Is there a solution?
 
C

Chad DeMeyer

Alain,

To do that you need to use the following instead of FollowHyperlink.

Sub CreateDocFromTemplate()
Documents.Add Template:="D:\My Documents\Word
Documents\Recipes\Waffles.dot"
End Sub

Regards,
Chad
 

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