Hi Guys,
I am new to VB. I got an VBA application wizard where I put the image control. When I click that image it needs to open the web browser and go to that url address. Can anybody help in writing this code?
Thanks
Printable View
Hi Guys,
I am new to VB. I got an VBA application wizard where I put the image control. When I click that image it needs to open the web browser and go to that url address. Can anybody help in writing this code?
Thanks
Just code this at click event of image
Shell "C:\Program Files\Plus!\Microsoft Internet\IEXPLORE.EXE http://www.microsoft.com", vbMaximizedFocus
'Declare this in modules
Public 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
'Use this procedure
Public Sub Link2Net(Address As String)
' Starts the default browser and Address as specified in the argument "Address"
Dim iret As Long
iret = ShellExecute(Form1.hwnd, vbNullString, _
Address, vbNullString, "c:\", SW_SHOWNORMAL)
End Sub
'Example
'on the click event of the image control
Call Link2Net("http://members.fortunecity.com/rbnwares1")
'It will automatically launch the default browser with the supplied address
Thanks for the replies Guys.