Launch Internet Explorer using the SHDocVw Library- May 2003

Larry Serflaten [] posted an interesting solution to a common news group question - how to launch Internet Explorer? He used the SHDocVw type library to instantiate a new SHDocVw.InternetExplorer. I wrote some 'demo' code to test the process and decided to make it the May 2003 tip of the month. Thanks Larry.

The Demo Program

I created a VB6 demo program to launch NASA TV in a small IE window. Screen shots:

Click the Launch button to start NASA TV

Streaming Video using Microsoft Media Player.
Allow a few minutes for the video to begin.

Sample Calling Code

Private Sub LaunchNASATV()
    Dim sFile As String
    sFile = AddBackslash(App.Path) & "NasaTV.HTM"
    If Len(Dir(sFile)) Then 'exist?
        LaunchIE sFile      'yes
    Else                    'no
        MsgBox "File not found:" & vbCrLf & sFile, vbCritical
    End If
End Sub

The LaunchIE Subroutine

Subroutine Description
LaunchIE (URL as String) Launch Internet Explorer using URL as the address.

Modules Used in the Demo

Module - Click for More Info Description Used in the Demo To
modLaunchIE.bas Contains the subroutine described above. The subject of this tip. Include it in your application.
modConnectToWebSite.bas Connect to a web site Show this info when Help/Info is selected from the demo.
modInfoAbout.bas Info and about help. Provide help via the web and 'about' info.
modAddBackSlash.bas Check for a right backslash and add if necessary. Add backslash to App.Path.

Download VB 6 Source Code

Click here to download the VB 6 source code [6k].

Previous Tip   Tip Index   Next Tip   First Tip


Updated 2011/10/06