Reputation: 61
I have a code that specifies a specific type of browser to be used when opening a link, now I want the code to open the link using the computer's default browser instead of the specified browser.
I have set the line of code to "defaultbrowser.application" and "default_browser.application" instead of "InternetExplorer.application"
Sub sbExitHTA
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = true
IE.Navigate2 "yahoo.com"
'IE.Navigate2 "yahoo.com"
'<a href="yahoo.com">Yahoo</a>
Self.Close()
I want the code to open my computer's default browser which is not internet explorer instead of internet explorer
Upvotes: 0
Views: 267
Reputation: 5031
The following code uses your default browser:
Dim objWScriptShell
Set objWScriptShell = CreateObject("WScript.Shell")
objWScriptShell.Run "https://yahoo.com", 9
Here is documentation about the Run command and the intWindowStyle
parameter (I used 9 here).
Upvotes: 2