ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Command for userform to load website link (https://www.excelbanter.com/excel-programming/351763-command-userform-load-website-link.html)

Danny Boy via OfficeKB.com

Command for userform to load website link
 
Hi

I have made a label for my site within my userform, how can I make it load my
site?

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200601/1

Leith Ross[_511_]

Command for userform to load website link
 

Hello Danny Boy,

This macro will launch your default browser and connect you with your
site. There are to parts to this. The call to macro will be placed
inside your label's Click Event (the default). The macro code must be
placed in a VBA module in your workbook.

Macro Code for Module:
_____________________________

Private Declare Function ShellExecute _
Lib "shell32.dll" _
Alias "ShellExecuteA" _
(ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long

Public Sub OpenURL(ByRef URL As String)
Dim RetVal
RetVal = ShellExecute(0&, "open", URL, vbNullString, vbNullString, 1)
If RetVal < 33 Then MsgBox "An error occurred while opening the site."
End Sub
_____________________________


Label Click Event Code:
_____________________________
Sub Label1_Click()
Call OpenURL("http:/www.excelforum.com/")
End Sub
_____________________________

Be sure to change the label name from Label1 to your label's name and
the URL to what you using.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=506217


Danny Boy via OfficeKB.com

Command for userform to load website link
 
Thanks Leith,

Although I found another method,

I have the address in a cell within my workbook so I called it from my cell
as below


Private Sub Image1_Click()
Range("v99").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
End Sub

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200601/1


All times are GMT +1. The time now is 10:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com