Results 1 to 4 of 4

Thread: Open a HTML document

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Location
    Sweden
    Posts
    13

    Smile

    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.
    You canīt hit what you cant see

  2. #2
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655
    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.
    www.RealisticGraphics.net

    Running VS.Net Enterprise & VB 6

    Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML

    MSN Messenger: kmsheff

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Location
    Sweden
    Posts
    13

    Smile

    I will trie this, thank you for helping.
    You canīt hit what you cant see

  4. #4
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655
    no problem.
    www.RealisticGraphics.net

    Running VS.Net Enterprise & VB 6

    Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML

    MSN Messenger: kmsheff

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width