Link to home
Create AccountLog in
Avatar of diamil
diamil

asked on

Vb and Internet explorer

How can I from my application direct users when they click a command to a particular URL.
Avatar of venky_dude
venky_dude

diamil
do u want the users to go to a url in an browser window which is already opened or in a new browser window
ASKER CERTIFIED SOLUTION
Avatar of AJAY CHADHA
AJAY CHADHA
Flag of India image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Other Method is with ShellExecute API.

Option Explicit
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

Dim Temp As String
Private Const SW_NORMAL = 1

Private Sub Command1_Click() ' Hyperlink with the use of API
Dim var As Long
Temp = "www.abc.com"
var = ShellExecute(hwnd, "open", Temp, vbNullString, vbNullString, SW_NORMAL)
End Sub

Private Sub Command2_Click() ' Hyperlink without API
Temp = "www.abc.com"
Shell "Start " & Temp, vbHide
End Sub


Good Luck...

Ajay Chadha ... :-)
shellexecute is the preferred method...using shell with start command does not work on NT, at least not on Win2k