Have a go with this to launch in deafult browser
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
Public Declare Function GetDesktopWindow Lib "user32" () As Long
Sub Test()
Dim hWndDesk As Long
Dim res&
Dim sFile$
sFile = Environ("temp") & "\" & "myFile.htm"
hWndDesk = GetDesktopWindow()
res = ShellExecute(hWndDesk, vbNullString, sFile, _
vbNullString, vbNullString, vbNormalFocus)
Debug.Print res
Select Case res
Case Is > 32
' should be up & running
Case 2
'file not found
Case Else
'some other error specific to res
End Select
End Sub
Might also need something along the lines of ShellAndWait, search google for
other error codes.
Regards,
Peter T
"Adrian D. Bailey" <(E-Mail Removed)> wrote in message
news:ejc67u$bn6$(E-Mail Removed)...
> I have a VBmacro that writes some webpages.
> I want the last line of the macro to launch a browser to display the first
> of the pages.
>
> I've tried this...
> dummy = Shell("iexplore " & Environ("temp") & "\showpeople1.htm",
> vbNormalFocus)
> ...but I get File Not Found.
>
> Oddly, if I replace "iexplore" with "notepad" it works, with Notepad
> launching and showing me the HTML code.
>
> Ideally, I'd like to launch the user's default browser - whether that's
IE,
> or Firefox or whatever.
>
> Any tips, please?
> --
> Adrian D.Bailey, Information and Systems Manager, Dept.Human Sciences
> Loughborough University, Loughborough Leics, LE11 3TU, UK.
> (E-Mail Removed) Tel: 01509 223007 Fax: 01509 223940
>
> Community Warden, Storer and Burleigh Areas. Out-of-hours Tel: 01509
563263
> --
>
>