Open Internet Explorer in New Tab

Mindlesh

Board Regular
Joined
Apr 2, 2014
Messages
172
How can I incorporate this code:
Code:
Sub TestNewTabInIE()
'Source: http://stackoverflow.com/questions/17386091/vba-excel-2010-open-internet-explore-in-new-tab
Dim IE As Object

Set IE = CreateObject("InternetExplorer.Application")

With IE
    .Visible = True
    While .ReadyState <> 4 'READYSTATE_COMPLETE
        DoEvents
    Wend
'    .Navigate "http://yahoo.com", CLng(2048)
    .Navigate "[---Here I want to use Cellvalu (ActiveCell.Value)---]", CLng(2048)
End With
End Sub
into my macro:
Code:
Public Cellvalu As String
Public Brwsr As String

Sub LaunchBrowser()

    Dim bPath As String

    If Brwsr = "Firefox" Then
        bPath = "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
    ElseIf Brwsr = "IE" Then
'        bPath = "C:\Program Files\Internet Explorer\iexplore.exe"
        [---Where I want to substitute the new code---]
    Else
        Exit Sub
    End If

    Call Shell(bPath & " " & Cellvalu, vbNormalFocus)

End Sub
to force links that open in Internet Explorer in a new tab?
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Code:
Option Explicit

Public Cellvalu As String
Public Brwsr As String

Sub LaunchBrowser()

    Dim bPath As String
    Dim IE As Object
    Dim URL As String
    
    URL = ActiveCell.Value '[---Here I want to use Cellvalu assumes activecell contains goodaddress

    'URL = "https://www.google.com/?gws_rd=ssl"  'Uncomment for testing known good IP address
    'Brwsr = "IE" 'Uncomment for testing IE branch
    
    If Brwsr = "Firefox" Then
        bPath = "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
    ElseIf Brwsr = "IE" Then
        Set IE = CreateObject("InternetExplorer.Application")
        With IE
            .Visible = True 'IE becomes active
            .Navigate URL
            On Error Resume Next
            Do While .ReadyState <> 4 Or .Busy
                DoEvents
                If Err.Number = -2147417848 Then Exit Do 'In case of client disconnect
            Loop
            On Error GoTo 0
        End With
        Set IE = Nothing
    End If

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,967
Members
452,371
Latest member
Frana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top