Hello everyone,
I'm trying to figure out how to be able to list web pages name from a worksheet into a listbox and then when clicking on that link and click the "Consult" button, the selected web page should open. I already have that code:
But I'm getting the "
Error" msgBox every links I try EXCEPT for the http://www.microsoft.com that opens "C:\WINNT\system32\Microsoft" ![Confused :confused: :confused:](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Here's the link to my dummy worksheet: https://www.dropbox.com/s/yb12bjpdw8u8j0b/links_workbook.xls
Thanks!
I'm trying to figure out how to be able to list web pages name from a worksheet into a listbox and then when clicking on that link and click the "Consult" button, the selected web page should open. I already have that code:
Code:
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
Private Sub CommandButton5_Click()
Dim URL As String
Dim Result As Long
With Me.list_links
If .ListIndex <> -1 Then
URL = .Value
Result = ShellExecute(0&, vbNullString, URL, _
vbNullString, vbNullString, vbNormalFocus)
If Result < 32 Then MsgBox "Error", vbCritical
Else
MsgBox "Please make a selection and try again!", vbExclamation
End If
End With
End Sub
Private Sub UserForm_Initialize()
Dim cLinks As Range
Set ws = Worksheets("Links")
For Each cLinks In ws.Range("Links_title")
With Me.list_links
.AddItem cLinks.Value
End With
Next cLinks
End Sub
But I'm getting the "
Here's the link to my dummy worksheet: https://www.dropbox.com/s/yb12bjpdw8u8j0b/links_workbook.xls
Thanks!
Last edited: