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

x
?
Solved

Opening URL in default browser

Posted on 1999-06-25
25
Medium Priority
?
164 Views
Last Modified: 2010-05-02
How do I open a URL in the default browser when a user presses a button?
0
Comment
Question by:mkill22
[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
  • 10
  • 7
  • 6
  • +2
25 Comments
 

Expert Comment

by:DarrenJ
ID: 1519710

To open a URL you can call the

  ShellExecute()

API Call, Look in the API-Text Viewer for the declaration

Pass the URL String (http://www.microsoft.com) in as the
filename and it should open a instance of the browser and display the page!
0
 
LVL 1

Author Comment

by:mkill22
ID: 1519711
could you give me an example? I've never used the api viewer and when I typed it in nothing happend, all the buttons etc were greyed out.

thanks
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1519712
call ShellExecute(0, "open", "http://www.yahoo.com", vbNullString, vbNullString, SW_SHOWNORMAL)

..-=ViKtOr=-..
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Expert Comment

by:reflex16
ID: 1519713
addy = "http://yahoo.com"    'or whatever
retval = shell("start " & ch(34) & addy & chr(34))
0
 
LVL 1

Author Comment

by:mkill22
ID: 1519714
viktornet:

Thanks but that gives me an error sub or function not defined.

reflex16:

Thanks that works!
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 1519715
use
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

before you start with viktornet method

0
 
LVL 1

Author Comment

by:mkill22
ID: 1519716
Thanks Inteqam. That's better!
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 1519717
did it work?


0
 
LVL 1

Author Comment

by:mkill22
ID: 1519718
yes.
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 1519719
thats better ,

i think viktor can claim the points now, right ?
but what about reflex16 ?


0
 
LVL 10

Expert Comment

by:viktornet
ID: 1519720
who's getting the points?
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 1519721
whos code you used?

0
 
LVL 1

Author Comment

by:mkill22
ID: 1519722
Calm down, I haven't forgotten, I do take the odd weekend off : )

I used viktornet's  code which worked when I added Integam's.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1519723
well, what does that mean? hehe :) who's gonna get the BIG prize ;)
0
 
LVL 1

Author Comment

by:mkill22
ID: 1519724
How about the first person to re-answer the question? : )
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 1519725
me

0
 
LVL 7

Expert Comment

by:Inteqam
ID: 1519726
:o)

0
 
LVL 1

Author Comment

by:mkill22
ID: 1519727
don't you have to answer the question before I can give you points?
0
 
LVL 1

Author Comment

by:mkill22
ID: 1519728
don't you have to answer the question before I can give you points?
0
 
LVL 1

Author Comment

by:mkill22
ID: 1519729
don't you have to answer the question before I can give you points?
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1519730
oh come on.... just pick someone... it's 5 pts after all...
0
 
LVL 1

Author Comment

by:mkill22
ID: 1519731
answer the bl***dy question and they're yours! I can't give you the points unless you answer the question. There is no facility to transfer points other than that.
0
 
LVL 10

Accepted Solution

by:
viktornet earned 0 total points
ID: 1519732
k.. i'll go for 'em then...
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 1519733
lol

0
 
LVL 10

Expert Comment

by:viktornet
ID: 1519734
rofl
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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 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…
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

670 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