This code will open the default web browser.
Code: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 Function ShellToBrowser%(frm As Form, ByVal url$, ByVal WindowStyle%) Dim api% api% = ShellExecute(frm.hwnd, "open", url$, "", App.Path, WindowStyle%) 'Check return value If api% < 31 Then 'error code - see api help for more info MsgBox App.Title & " had a problem running your web browser. You should check that your browser is correctly installed. (Error #" & Format$(api%) & ")", 48, "Browser Unavailable" ShellToBrowser% = False ElseIf api% = 32 Then 'no file association MsgBox App.Title & " could not find a file association for " & url$ & " on your system. You should check that your browser is correctly installed and associated with this type of file.", 48, "Browser Unavailable" ShellToBrowser% = False Else ShellToBrowser% = True End If End Function Usage: ShellToBrowser(Me,"http://www.site.com",0)




Reply With Quote