Reputation: 11
Is there a way to open html page from vba directly in default browser? I don't want to create a form and use webbrowser or similar component. The idea is open external browser and write page in it somehow...
Upvotes: 0
Views: 210
Reputation: 33813
To open a predefined URL in a named browser you can use VBScript like this:
Dim strURL: strURL="https://stackoverflow.com/questions/67530458/open-html-page-from-memory"
Dim iState:iState=3
Dim bWait:bWait=true
Set oWS=CreateObject("Wscript.Shell")
oWS.Run "chrome -url " & strURL,iState,bWait
oWS.Run "firefox -url " & strURL,iState,bWait
set oWS=nothing
If you omit the browser name it should invoke the default browser.
It is years since I used VBA but I'm fairly confident the approach is very similar in VBA.
Upvotes: 1