Solved

Open New Internet Explorer Window

Posted on 2002-07-12
8
175 Views
Last Modified: 2010-05-02
how can i programmatic browse to a specific web page in a NEW Internet Explorer window even if the user has there IE settings set to reuse IE windows?
0
Comment
Question by:Jambyte
8 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7148480
I use this code, which opens a new IE for me, even as i have configured to reuse IE windows:

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

Private Sub Navigate(ByVal NavTo As String)
  Dim hBrowse As Long
  hBrowse = ShellExecute(0&, "open", NavTo, "", "", SW_SHOW)
End Sub


CHeers
0
 
LVL 2

Expert Comment

by:priya_pbk
ID: 7148500
try this:

In windows 2000:-

Privat Sub command1_click()
Call Shell("C:/Program Files/Internet Explorer/iexplore.exe http://www.experts-exchange.com", vbNormalFocus)
End Sub

In others(like windows NT) etc

Privat Sub command1_click()
Call Shell("c:/program Files/Plus!/Microsoft Internet/iexplore.exe http://www.experts-exchange.com", vbNormalFocus)
End Sub

Hope this helps!

-priya


0
 
LVL 2

Author Comment

by:Jambyte
ID: 7148580
angelIII, your code seems to be the most elegent but it doesn't open a new window if reuse current IE window is enabled in windows xp IE6.

priya_pbk, is there a way to make new window be in front, be active, or have focus know what i mean?
0
 
LVL 2

Expert Comment

by:priya_pbk
ID: 7148617
Actually speaking, I did not have a good read at your question. I had just read the headline qt in the main page.

Again, the above code was for opening IE programatically thru vb (which i thought you wanted)!


if so, change the second parameter to "vbMinimizedFocus" instead of "vbNormalFocus", will this help!

-priya
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 28

Expert Comment

by:AzraSound
ID: 7148989
Dim IE
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate strURL
0
 

Expert Comment

by:itmelo
ID: 7149259
I found this code in Microsoft's Knowledge Database some time ago and I use it quite a bit. It opens a new browser window even if others are open.

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q174156

Give it a try...

Private Const SW_SHOW = 5 ' Displays Window in its current size and position
Private Const SW_SHOWNORMAL = 1 ' Restores Window if Minimized or Maximized

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 FindExecutable Lib "shell32.dll" Alias _
         "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As _
         String, ByVal lpResult As String) As Long

Private Sub Command1_Click()
      Dim FileName, Dummy As String
      Dim BrowserExec As String * 255
      Dim RetVal As Long
      Dim FileNumber As Integer

      ' First, create a known, temporary HTML file
      BrowserExec = Space(255)
      FileName = "C:\temphtm.HTM"
      FileNumber = FreeFile                    ' Get unused file number
      Open FileName For Output As #FileNumber  ' Create temp HTML file
          Write #FileNumber, "<HTML> <\HTML>"  ' Output text
      Close #FileNumber                        ' Close file
      ' Then find the application associated with it
      RetVal = FindExecutable(FileName, Dummy, BrowserExec)
      BrowserExec = Trim(BrowserExec)
      ' If an application is found, launch it!
      If RetVal <= 32 Or IsEmpty(BrowserExec) Then ' Error
          MsgBox "Could not find associated Browser", vbExclamation, _
            "Browser Not Found"
      Else
          RetVal = ShellExecute(Me.hwnd, "open", BrowserExec, _
            "www.microsoft.com", Dummy, SW_SHOWNORMAL)
          If RetVal <= 32 Then        ' Error
              MsgBox "Web Page not Opened", vbExclamation, "URL Failed"
          End If
      End If
      Kill FileName                   ' delete temp HTML file
End Sub
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 8002363
Hi Jambyte,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Refund points and save as a 0-pt PAQ.

    *** NOTE: I thought that angelIII's techniqye should work, but if it doesn't than maybe AzraSound's  will also fail.  Can anyone say for sure?

Jambyte, Please DO NOT accept this comment as an answer.
EXPERTS: Post a comment if you are certain that an expert deserves credit.  Explain why.
==========
DanRollins -- EE database cleanup volunteer
0
 

Accepted Solution

by:
SpideyMod earned 0 total points
ID: 8095354
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

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.
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now