• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 130
  • Last Modified:

Loading an HTML file from application

Is there a quick way to load an HTML file from inside a VB program (not in the program, but using their default browser)? Any help would be appreciated.
  • 2
1 Solution
in a module put:

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 Const SW_NORMAL = 1

in command button or wherever loading the url put:

dim results as long

results = ShellExecute(0, "open", "http://www.msn.com", vbNullString, vbNullString, SW_NORMAL)

You can also use the webbrowser control and tell it to do work. See my web page (www.cyberchute.com/rvbus/madmark) for working browser using form with single button and web control. Total source code under 1 page! Source included with project.


bstuffAuthor Commented:
Sorry, I guess I wasn't quite clear on that... the HTML file is in the same directory as the program on the hard drive, say, for example, it's "help.html". AppActivate hasn't worked for me and I was wondering if there was any other easy way to do it.

y2kwacko, it's only fair that I give you another chance, since you were the first one to propose and answer (and it was quite lovely, by the way), so I'll let you finish up... if you know how to do it.

Thanks again!
Use the same example just replace the url with the filename of the html file
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now