I have multiple webpage hyperlinks in a column & I want to open them inside activeX Web browser control just by clicking on the hyperlink because it will take more time if I create command button for each cell or if there is any other possibility to do this. check eg. screen shot attached
screen no.1
screen no.2
You can create your own Hyperlinks by adding a prefix to them like "MyLink:". Doubleclicking those cells loads the address to the browser control.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
' Define Your Own Weblink identifier
Dim MYLINKPREFIX As String
MYLINKPREFIX = "MyLink:"
' Check if the value of the doubleclicked cell is one of your "weblinks"
Dim isMyLink As Boolean
isMyLink = (Left(Target.Value, Len(MYLINKPREFIX)) = MYLINKPREFIX)
' If its one of your links, cut out the address, paste it to the browser control.
' At the end cancel the double click event of the cell, to avoid going into cell-edit mode.
If (isMyLink) Then
Dim TargetAddress As String
TargetAddress = Right(Target.Value, Len(Target.Value) - Len(MYLINKPREFIX))
WebBrowser1.Navigate TargetAddress
Cancel = True ' Cancel the Double Click to avoid edit mode
End If
End Sub
Check if a cells value begins with your prefix. Do this at the cells doubleclick event inside your worksheet. If the cells value begins with "Mylink:" Prefix, you can get rid of the prefix text while you keeping the addressname.
Take this addressname and open it with your browser control.
Cancel the Doubleclick event if it is one of your customer webaddresses to avoid cell edit mode, since you only want to see the webpage.
Instead of unsing a long prefix like "MyLink:" I would recomend to use a short marker like "> ". The Prefix is only to prevent excel to generate a hyperlink from the value by itself.