Opening web page in a new window [RESOLVED]
I have the code to open a web page when a button is clicked, but it just changes the current IE window. How do I modify this code to open the page in a new window?
VB Code:
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_SHOWNORMAL As Long = 1
Private Const SW_SHOWMINIMIZED As Long = 2
Private Const SW_SHOWMAXIMIZED As Long = 3
and the button code:
VB Code:
Private Sub cmdCRKC_Click()
ShellExecute Me.hwnd, "Open", "http://localhost/indexCRKCG1_G2.asp", vbNullString, "C:\", SW_SHOWNORMAL
End Sub
Re: Opening web page in a new window
Courtesy of TheVader. This will open 4 different pages in 4 different windows. Set a reference to Microsoft Internet Explorer Controls
VB Code:
Option Explicit
Private objIE As InternetExplorer
Private Sub Command1_Click()
Set objIE = New InternetExplorer
objIE.Visible = True
objIE.Navigate2 "http://www.vbforums.com"
Do While objIE.Busy = True
DoEvents
Loop
Set objIE = Nothing
End Sub
Private Sub Command2_Click()
Set objIE = New InternetExplorer
objIE.Visible = True
objIE.Navigate2 "http://www.google.com"
Do While objIE.Busy = True
DoEvents
Loop
Set objIE = Nothing
End Sub
Private Sub Command3_Click()
Set objIE = New InternetExplorer
objIE.Visible = True
objIE.Navigate2 "http://www.microsoft.com"
Do While objIE.Busy = True
DoEvents
Loop
Set objIE = Nothing
End Sub
Private Sub Command4_Click()
Set objIE = New InternetExplorer
objIE.Visible = True
objIE.Navigate2 "http://www.hotmail.com"
Do While objIE.Busy = True
DoEvents
Loop
Set objIE = Nothing
End Sub