?
Solved

VB3: Access web site URL from program

Posted on 1998-06-18
6
Medium Priority
?
483 Views
Last Modified: 2012-06-21
I would like to open the default browser and go to my web site (or any other URL) from my program (VB3).  I tried using"
ShellExecute(0&, vbNullString, URL, vbNullString, vbNullString, vbNormalFocus)

(by the way, where is vbNullString defined? I would think this would give me an undefined error)

This worked at home.  I came in to work and tried it and the shellexecute returns a 2 (could not find file, i think, what file?) and does not open IE.

Thanks in advance,
Rob
0
Comment
Question by:RentRight
[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
  • 3
  • 2
6 Comments
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1463726
Check if you have assosiation for .html files
0
 
LVL 1

Expert Comment

by:cip
ID: 1463727
If you're working with Windows NT, 16 bit ShellExecute will give error code 2 if the associated executable file exists in a directory path containing a long file name. This happens only on Windows NT systems, Windows 3.x and Windows 95 will work fine.You can find more info in Microsoft Knowledge base article Q172982.

0
 

Author Comment

by:RentRight
ID: 1463728
I am using windows 95, I checked the association by puting a shortcut on my desktop that was "http://www.rent-right.com"  This opens IE and dials in.

One other thing, I have two PC's at work.  One gives me an error (undefinded var.) for vbnullString, the other does not.  But both fail with a 2 from shellexecute.

Thanks for the help,
Rob
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:RentRight
ID: 1463729
Adjusted points to 120
0
 
LVL 1

Accepted Solution

by:
cip earned 360 total points
ID: 1463730
Rob,

VbNullString should give a "variable not defined" sintax error in vb3,
unless the "option explicit" statement is omitted in the declaration
section of the module.

The example below works fine on my PC, hope it can help since it is sligthly
different from yours. The second parameter in the ShellExecute declaration
is defined of type "Any" rather than "String", to allow passing a null pointer.
If you want to keep the "String" type, you should pass "open" as the second
parameter, for example:

ShellExecute(0&, "open", URL, "", "", 0)


--------------------------------------------
Declare Function ShellExecute Lib "shell.dll" (ByVal hwnd As Integer, ByVal lpOperation As Any, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Integer) As Integer

Sub Command1_Click ()
    Dim r As Integer
    Dim URL As String

    URL = "http://www.rent-right.com"
    r = ShellExecute(0&, 0&, URL, "", "", 0)
   debug.print r
end sub
--------------------------------------------

0
 

Author Comment

by:RentRight
ID: 1463731
Thanks, you got it.

It was the way I was declaring ShellExecute.  I used the declare out of the book using the Windows API with VB.  When I changed it to your declare, all of my previous versions worked.

Thanks again.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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

771 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