Consulting

Results 1 to 5 of 5

Thread: VBA to open list of hyperlinks in non-default browser?

  1. #1
    VBAX Newbie
    Joined
    Jul 2015
    Posts
    4
    Location

    Question VBA to open list of hyperlinks in non-default browser?

    Hi Everyone!

    I have a code (below) that opens a list of hyperlinks that I have on sheet "Tab" and my hyperlinks are in the excel sheet at cell A2, A3.. at 30 second intervals..
    This code runs perfectly on my default browser (Chrome) .

    I want it to do the Exact same thing on Firefox and IE without Changing my default browser.
    Hence, Yes I want the same tabs/pages open on 3 different browsers. (I have my reasons for wanting/needing this).
    I've been trying to find a simple way to code it, such as something like adding
    Dim IE As Object
    Set IE = CreateObject("InternetExplorer.Application") to the top like that.. I hope it can be simple like that, but so far it hasn't been...

    Please help, thank you very much!!

    thanks!!
    Ly

    Windows 8
    Excel 2010
    VBA knowledge : (very very basic/beginner)

    Code below:

    Sub Openlinks ()

    On Error Resume Next
    Sheets("Tab").Select

    Range("A2").Select
    Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
    Application.Wait (Now + TimeValue("00:00:30"))
    Range("A3").Select
    Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
    Application.Wait (Now + TimeValue("00:00:30"))

    End Sub

  2. #2
    VBAX Newbie
    Joined
    Jul 2015
    Posts
    4
    Location
    I found a decent workaround for IE.. not firefox yet

    Sub InternetExp()


    On Error Resume Next


    Dim ie As Object
    Set ie = CreateObject("InternetExplorer.Application")

    ie.Navigate Sheets("tab").Range("A2").Value
    ie.Visible = True
    Application.Wait (Now + TimeValue("00:00:30"))

    end sub

  3. #3
    VBAX Newbie
    Joined
    Jul 2015
    Posts
    4
    Location
    So I found an answer / workaround to my own question for Firefox.. you have to put the link inside with 3 """ on each side. This gets the job done.


    Sub Firefox()


    Dim objShell


    Set objShell = CreateObject("WScript.Shell")
    objShell.Run ("""C:\Program Files (x86)\Mozilla Firefox\Firefox.exe"" ""www . Hyperlink 1 .com """)
    Application.Wait (Now + TimeValue("00:00:10"))


    objShell.Run ("""C:\Program Files (x86)\Mozilla Firefox\Firefox.exe"" ""www . Hyperlink2 .com""")


    End Sub

  4. #4
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    Shell() will suffice.

  5. #5
    VBAX Newbie
    Joined
    Jul 2015
    Posts
    4
    Location
    And for good measure.. if you want to use Opera..

    Sub Opera()


    Dim objShell
    Set objShell = CreateObject("WScript.Shell")

    objShell.Run ("""C:\Program Files (x86)\Opera\launcher.exe"" ""website . com """)


    End Sub

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •