-
Set to default browser
Can someone help change this to call the default browser, not Internet browser. Thanks for your help.
[VBA]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[/VBA]
-
[VBA]Sub default()
Dim objshell As Object
Set objshell = CreateObject("Shell.Application")
objshell.Open "http://www.pdtraveler.com/download.htm"
End Sub
[/VBA]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
-
Or if you prefer api..
[VBA]
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"
End Sub
[/VBA]
-
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules