Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Open the favorite webbrowser from VB

Posted on 1999-01-08
4
Medium Priority
?
160 Views
Last Modified: 2010-05-03
This is probably a common question. I want to be able to open HTML-documents in the user's webbrowser. To make it a little harder for you, experts, I want to make sure that a 4.0 browser from Netscape or Microsoft is used. How can I achieve this?
0
Comment
Question by:liljegren
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 

Author Comment

by:liljegren
ID: 1454907
Edited text of question
0
 
LVL 1

Expert Comment

by:bear454
ID: 1454908
And what do you do if the user does not have a 4.x browser installed?
0
 
LVL 13

Accepted Solution

by:
Mirkwood earned 150 total points
ID: 1454909
Here is how to execute a html file.
To verify whether or not version4 is installed is a completly other question.

Private 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

Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Const SW_SHOWNORMAL = 1
  

     'Description:How do I launch a file in its associated program?

Function StartDoc(DocName As String) As Long

       Dim Scr_hDC As Long
       Scr_hDC = GetDesktopWindow()
       StartDoc = ShellExecute(Scr_hDC, "Open", DocName, "", "C:\", SW_SHOWNORMAL)
End Function
  
Private Sub Form_Click()
       Dim r As Long
       r = StartDoc("c:\myhtml.html")
       Debug.Print "Return code from Startdoc: "; r
End Sub

0
 

Author Comment

by:liljegren
ID: 1454910
That was a piece of useful code. Guess I have to make another question on the 4.0 issue. The program generate HTML documents. If the user doesn't have a 4.0 browser, the program should generate a HTML 3.2 document with <FONT> tags, instead of the HTML 4.0 + CSS document.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question