[RESOLVED] Opening an URL with VB (again !)
Hi !
I use this code in my VB-app, and it works fine on my computer:
*Dim A as Integer
A = Shell("C:\Program Files\Internet Explorer\IEXPLORE.exe http://www.xxx.com ", vbMaximizedFocus)*
But how do I know wether other users have IXPLORER.exe in \Program.. or in \Program Files... ? Is there any codes for covering any situations ?
/Kalle in Sweden
Re: Opening an URL with VB (again !)
try shellexecute api, there will be many examples in this forum
Re: Opening an URL with VB (again !)
Start a new VB project and run this code (add a command button Command1 to the form):
Code:
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
'Use API Viewer to see other constants.
Private Const SW_NORMAL = 1
Private Sub Command1_Click()
ShellExecute Me.hwnd, "open", _
"http://www.vbforums.com/newreply.php?do=newreply&noquote=1&p=3190402", _
vbNullString, vbNullString, SW_NORMAL
End Sub
Re: [RESOLVED] Opening an URL with VB (again !)
Thanks a lot, DigiRev !
It worked out just fine, and I have not to worry about where IE is located !
The default browser will be used as I can see...