Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Simple Shell??? Question

Posted on 1998-09-27
2
Medium Priority
?
199 Views
Last Modified: 2010-04-30
Hi!

I have a VERY simple question.
I have VB5

I want my program to open up the user's browser, and bring up a homepage.

Thing is, A. We don't know where the browser is, and B. Netscape or INternet Explorer?

I tried a couple of things:
x% = shell("http://whatever.com", Vbwhatever)
will bring up: filenotfound

x% = shell("c:\windows\explorer http://whatever.com", vbwhatever)
This will work, as long as you have IE 4...
I want it to work nomatter what

Please help :)
0
Comment
Question by:eversoslightly
[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 Comments
 
LVL 1

Accepted Solution

by:
saam earned 40 total points
ID: 1436842
Option Explicit

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 Const SW_SHOW = 5
-------------------------------------------------------------------------------------------------------------------------------

'This will open the url: http://whatever in the system's default browser when the user clicks 'the button named Command1.
Private Sub Command1_Click()
    ShellExecute hwnd, "open", "http://whatever", vbNullString, vbNullString, SW_SHOW
End Sub

/saam
0
 
LVL 1

Author Comment

by:eversoslightly
ID: 1436843
Thanks!

Works great.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

715 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