I am struggling to get this done since months, how to code VBA to open internet explorer in new session i have an application with many logins i need to open them simultane
Apparently the -nomerge
argument will prevent session merging.
Shell("iexplore.exe -nomerge http://www.yoursite.com")
UPDATE
As per your comment, you need to get the IE object. You may be able to work with this:
Dim wshShell
Set wshShell = WScript.CreateObject("WScript.Shell")
wshShell.Run "iexplore -nomerge http://www.google.com"
Dim objShell
Set objShell = CreateObject("Shell.Application")
Dim objShellWindows
Set objShellWindows = objShell.Windows
Dim i
Dim ieObject
For i = 0 To objShellWindows.Count - 1
If InStr(objShellWindows.Item(i).FullName, "iexplore.exe") <> 0 Then
Set ieObject = objShellWindows.Item(i)
If VarType(ieObject.Document) = 8 Then
MsgBox "Loaded " & ieObject.Document.Title
Exit For
End If
End If
Next
Set ieObject = Nothing
Set objShellWindows = Nothing
Set objShell = Nothing
Set wshShell = Nothing
This answer works for me after changing:
Dim IE As InternetExplorer
to
Dim IE As Object
Using Excel 2010 - This is what I use with a command button. Replace google.com with the website you want to open in another browser.
Private Sub commandname_Click()
'Opens an Explorer with a web site
Dim IE As InternetExplorer
Set IE = CreateObject("InternetExplorer.Application")
IE.navigate ("http://WWW.GOOGLE.COM")
IE.Visible = True
End Sub