Link to home
Start Free TrialLog in
Avatar of gisvpn
gisvpnFlag for United States of America

asked on

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
Avatar of honestman31
honestman31

Avatar of gisvpn

ASKER

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?
Avatar of GrahamSkan
You can use  Macrobutton field  to call a macro like this:

Sub OpenForm()
    UserForm1.Show
End Sub  
is the form inside the same document ? if so then the link is correct
- 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 
Avatar of gisvpn

ASKER

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?

 
- 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".
Avatar of gisvpn

ASKER

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
- 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"
This should work. What is the problem?
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.
Avatar of gisvpn

ASKER

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

Avatar of gisvpn

ASKER

Can anyone comment on the above :) ?

- 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".
ASKER CERTIFIED SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial