Link Button or Hyperlink in Word Document to User Form

Hello,

I am creating a user form in Word for users to fill in. How is it possible to create either a Hyperlink or Button in the Word Document so that when someone clicks on it it will call the User Form?

I am using Word 2007 and 2010 for this User Form (not sure if the solution will differ between versions?)

Thanks in advance.

GISVPN
gisvpnAsked:
Who is Participating?
 
GrahamSkanConnect With a Mentor RetiredCommented:
To emphasise. There are two views for fields - the code and the results. The Alt+F9 key stroke shortcut toggles between them for the whole document.

The Word document has a FollowHyperlink method which will do the same as clicking on the Hyperlink does. It does not have a FollowHyperlink event which could be used to do something else when the Hyperlink is clicked. We must use a Macrobutton field to call VBA code instead.

0
 
gisvpnAuthor Commented:
Hi honestman31: thanks for the post, I am not sure if you have fully read the question but im trying to use a hyperlink and or button to call a User Form?

The link you posted I think just explains links in Word?
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
GrahamSkanRetiredCommented:
You can use  Macrobutton field  to call a macro like this:

Sub OpenForm()
    UserForm1.Show
End Sub  
0
 
honestman31Commented:
is the form inside the same document ? if so then the link is correct
0
 
OP_ZaharinCommented:
- try the instruction in the following page. in the macro modules, put the syntax "formname.show" (without the doublequotes) to display the form.

http://word.mvps.org/FAQs/MacrosVBA/AssignMacroToButton.htm 
0
 
gisvpnAuthor Commented:
Hi there thansk for the posts.

GrahamSkan - thanks for this I think this will be part of the solution as put forward by OP_Zaharin.

OP_Zaharin - This article works really well, however there is a problem. Everytime you close and reopen the document you have to select 'Toggle Field Codes' again for it to become a clickable hypertext.. so does not really work that well - is there another way?

 
0
 
OP_ZaharinCommented:
- you can either use Alt + F9 shortcut OR
- from the Office button - click Word Options - select Advanced and in the Show document content section, uncheck the checkbox for "Show field codes instead of their values".
0
 
gisvpnAuthor Commented:
Humm I dont think that will work; I simply want to allow the user to click the link or button to open the form.

Is there anyway to do this via hyperink?

GISVPN
0
 
OP_ZaharinCommented:
- none as i know. the only way is to set the following at all the users msword option (only one time), then it will appear as a link :
"from the Office button - click Word Options - select Advanced and in the Show document content section, uncheck the checkbox for "Show field codes instead of their values"
0
 
GrahamSkanRetiredCommented:
This should work. What is the problem?
0
 
GrahamSkanRetiredCommented:
You could also insert the field the Quick parts button on the Insert tab.
Choose Field..., select Macrobutton and put the macro name in. That way you won't have to switch to the Field codes view, if that is what you are having difficulty with.
0
 
gisvpnAuthor Commented:
Hi GrahamSkan, looking at your suggestion and OP_Zaharin's one they both result in exactly the same thing. When the document is saved and the reopened you just see this on the screen :

{ MACROBUTTON MyMacroName Double-Click To Run Macro }

you then have to right click it and select 'Toggle Field Codes'  to see it as a clickable link; which is not very good.

I have used this in Excel to do what I am trying to do in Word; Can I do something similar like this but in Word??

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)

If Target.Name = "Run Extractor 1" Then
Call converter1
End If


End Sub

Open in new window

0
 
gisvpnAuthor Commented:
Can anyone comment on the above :) ?

0
 
OP_ZaharinCommented:
- have you set the below? this setting should show the link not the { MACROBUTTON MyMacroName Double-Click To Run Macro }

from the Office button - click Word Options - select Advanced and in the Show document content section, uncheck the checkbox for "Show field codes instead of their values".
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.