View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_511_] Leith Ross[_511_] is offline
external usenet poster
 
Posts: 1
Default 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