How do I open an HTML page in the default browser with VBA? I know it’s something like:
Shell "http://myHtmlPage.com"
But I think I have to reference the program which will open the page.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use the Windows API function
ShellExecuteto do so:As given in comment, to make it work in 64-bit, you need add
PtrSafein the Private Declare Line as shown below:Just a short remark concerning security: If the URL comes from user input make sure to strictly validate that input as
ShellExecutewould execute any command with the user’s permissions, also aformat c:would be executed if the user is an administrator.