IS it possible to add Hyperlink to a commandbutton on a Userform

A

Ayo

I have a userform with a commandbutton. I want to add an hyperlink to the
commandbutton so that when the commandbutton is click, it opens up the
website. How do I go about doing that?
Thanks
 
D

Dave Peterson

Option Explicit
Private Sub CommandButton1_Click()
ThisWorkbook.FollowHyperlink Address:="http://www.microsoft.com"
End Sub

I think I'd use a label--format with blue font and underline--like a hyperlink
you'd see in the worksheet.
 
A

Ayo

But how would I change the mouse to the pointing finger to stimulate clicking
the label?
 
R

Rick Rothstein

Select the Label control, then (in the Properties Window) set the
MousePointer property to 99-fmMousePointerCustom and then set the MouseIcon
property to a compatible ICO or CUR file (stay away from any marked "aero")
in your Windows/Cursors directory (there is a pointing hand cursor in there
that will work).
 
A

Ayo

Thanks so much Rick. Works great.

Rick Rothstein said:
Select the Label control, then (in the Properties Window) set the
MousePointer property to 99-fmMousePointerCustom and then set the MouseIcon
property to a compatible ICO or CUR file (stay away from any marked "aero")
in your Windows/Cursors directory (there is a pointing hand cursor in there
that will work).

--
Rick (MVP - Excel)




.
 
K

Kevin Angle

I'm trying to perform something similar in one of my projects. How do I
modify the "hyperlink" syntax to open an Excel file on the server
instead?

ThisWorkbook.FollowHyperlink
Address:="\\server\share\folder1\folder2\filename.xls"
 
K

Kevin Angle

NM, I am all set. I was using variables to build the file path and just
needed to make them public.
 
K

Kevin Angle

NM, I am all set. I was using variables to build the file path and just
needed to make them public.
 

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