-
Hello I wonder if you could help me with a problem, I am making a cd menu with a HTML
Interface. But I want to have a Form that appears before the HTML menu is loaded.
And here starts my problem, for I dont know how to make VB open a HTML file, or any other file for that matter.
Can you give me the code on how to open a HTML file when I press a button.
-
Use the following API to open the html file in it's default browser, place the code in a module:
Code:
Public 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_SHOWNORMAL = 1
Public Sub OpenHTML(URL As String)
Dim Success As Long
Success = ShellExecute(0&, vbNullString, URL, vbNullString, "C:\", SW_SHOWNORMAL)
End Sub
then put this code in a button on your form
Code:
Private Sub Command1_Click()
OpenHTML "c:\test.html"
End Sub
Hope this helped.
-
I will trie this, thank you for helping.
-