PDA

View Full Version : Solved: Hyperlinking in buttons in UserForms



samuelwright
11-24-2005, 08:25 AM
Hi all

probably a dumb one. :doh: ..how do I set a button in a userform to open a hyperlink (e.g a webpage?). And how do I set the size of the window that opens so that it isnt a full page?
Sam

mdmackillop
11-24-2005, 10:26 AM
Hi Sam,
Part 1

Private Sub CommandButton1_Click()
ActiveWorkbook.FollowHyperlink "http://www.vbaexpress.com/forum/showthread.php?t=6168"
End Sub

fumei
11-25-2005, 06:16 AM
or better yet

Private Sub CommandButton1_Click()
ActiveWorkbook.FollowHyperlink _
"http://www.vbaexpress.com/forum/showthread.php?t=6168"
End Sub

samuelwright
11-25-2005, 06:33 AM
Thanks Guys! I will mark it solved.:thumb

samuelwright
11-25-2005, 07:29 AM
Hi, sorry, not quite solved: I want the window that the hyperlink opens to be a certain size. The following method I have tried does not seem to work. Can anyone tell me why?


Private Sub PropertiesDefenceTaxonomyButton_Click()
ActiveDocument.FollowHyperlink http://www.google.com
With ActiveWindow
Set .Height = 100
.Width = 100
End With
End Sub


Thank you, Sam

mdmackillop
12-02-2005, 06:24 AM
I've "unsolved" this for the second part of your question.

JamJam11
02-14-2011, 11:12 AM
Hi everyone,

I want to do the same thing; just hyperlink from a button on a Word UserForm.

I've added a simple button to the form and then added the code as mentioned earlier in this thread i.e.:

Private Sub cmbHelpMe_Click()
ActiveDocument.FollowHyperlink "the web address linked to"

End Sub

But all I get when I click on the button is a long pause and then an error message as follows:

Run-time error '4198'
Command failed

It does say "Word is preparing to load this document" at the bottom of the Word window (Status bar) during the pause. But that's it.

I've searched and searched for an answer.

Can anyone help?
Thanks,
John