PDA

View Full Version : Set to default browser



av8tordude
03-15-2011, 11:43 AM
Can someone help change this to call the default browser, not Internet browser. Thanks for your help.

Function VersionCheck() As String
Dim strControlID As String
Dim strReportID As String
Dim oBrowser As Object 'InternetExplorer
Dim sURL As String
Dim strVersion As String

sURL = "http://www.pdtraveler.com/download.htm"
Set oBrowser = Nothing: Set oBrowser = CreateObject("InternetExplorer.Application")
oBrowser.Silent = True
oBrowser.Navigate sURL
Do
Loop Until oBrowser.ReadyState = 4
strVersion = oBrowser.document.DocumentElement.innerText
If strVersion = vbNullString Then Exit Function
strVersion = Mid(strVersion, InStr(1, strVersion, "Version"), 25)
strVersion = Trim(Left(strVersion, InStr(1, strVersion, vbCrLf) - 1))
VersionCheck = strVersion
oBrowser.Quit
End Function

mdmackillop
03-15-2011, 04:25 PM
Sub default()
Dim objshell As Object
Set objshell = CreateObject("Shell.Application")
objshell.Open "http://www.pdtraveler.com/download.htm"
End Sub

Justinlabenne
03-15-2011, 07:09 PM
Or if you prefer 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

Public Sub FireUpABrowser(ByVal url As String)
ShellExecute 0&, "open", url, 0&, 0&, 1
End Sub

Public Sub TestMethodAbove()
FireUpABrowser "http://www.google.com (http://www.google.com/)"
End Sub

Kenneth Hobs
03-15-2011, 08:16 PM
Just opening a URL by another browser may not meet your needs. If you are going to use the MSIE objects, methods and properties, you need that object.