Solved

ShellExecute()  How do I change it to open a new window everytime?

Posted on 2007-03-30
6
655 Views
Last Modified: 2010-08-05
Expert Gurus
How do I change it to open a new window everytime?
 Please let me know.
 
Many Thanks

Ted


        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 = 1

        Public Sub Navigate(ByVal NavTo As String)
          Dim hBrowse As Long
          hBrowse = ShellExecute(0&, "open", NavTo, "", "", SW_SHOW)
        End Sub
0
Comment
Question by:tcalbaz
[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
  • 2
  • 2
6 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 18826346
Well that depends...

What is in "NavTo"?
0
 
LVL 1

Author Comment

by:tcalbaz
ID: 18826443
Nav_to is the URL.

Ted
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 250 total points
ID: 18826835
One way...

Click on Project --> References and check the "Microsoft Internet Controls" entry.

    Public Sub Navigate(ByVal NavTo As String)
        Dim ie As New InternetExplorer
        ie.Visible = True
        ie.Navigate NavTo
    End Sub
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 32

Expert Comment

by:Robberbaron (robr)
ID: 18828041
That does means hardcoding IE as webbrowser.

When you say new window, is it opening in a new tab sometimes ?  IE7 / FireFox2 ?
0
 
LVL 32

Assisted Solution

by:Robberbaron (robr)
Robberbaron (robr) earned 250 total points
ID: 18828056
see "How ShellExecute Determines Whether to Start a New Instance" in http://support.microsoft.com/kb/224816

example from MS is slightly different in that they dont use null for some reason.
   Dim r As Long
   r = ShellExecute(0, "open", "http://www.microsoft.com", 0, 0, 1)
0
 
LVL 1

Author Comment

by:tcalbaz
ID: 18828830
IdleMind
Thanks for the solution.

robberbaron
Very insightful and useful article.

I have split the points
Thank you

Ted
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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…

696 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