Hi all
probably a dumb one. ..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
Hi all
probably a dumb one. ..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
Hi Sam,
Part 1
[VBA]
Private Sub CommandButton1_Click()
ActiveWorkbook.FollowHyperlink "http://www.vbaexpress.com/forum/showthread.php?t=6168"
End Sub
[/VBA]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
or better yet
[vba]
Private Sub CommandButton1_Click()
ActiveWorkbook.FollowHyperlink _
"http://www.vbaexpress.com/forum/showthread.php?t=6168"
End Sub[/vba]
Thanks Guys! I will mark it solved.
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?
[VBA]
Private Sub PropertiesDefenceTaxonomyButton_Click()
ActiveDocument.FollowHyperlink http://www.google.com
With ActiveWindow
Set .Height = 100
.Width = 100
End With
End Sub
[/VBA]
Thank you, Sam
I've "unsolved" this for the second part of your question.
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
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.:
[vba]Private Sub cmbHelpMe_Click()
ActiveDocument.FollowHyperlink "the web address linked to"
End Sub[/vba]
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