+ Reply to Thread
Results 1 to 8 of 8

Opening links through a macro using non-default browser

  1. #1
    Registered User
    Join Date
    11-11-2021
    Location
    France
    MS-Off Ver
    2021
    Posts
    17

    Question Opening links through a macro using non-default browser

    Hi all,

    it's rather easy (well, not for me) : I have a macro that will open different links depending on a box checked earlier in the macro.

    So I have :

    Case "File1"
    If X Then Xa
    If Y Then Ya

    Case "File2"
    If X Then Xb
    If Y Then Yb

    etc.

    The problem is that there are multiple PCs that have a random combination of Chrome/Edge/IE installed, and the links work properly only on Chrome which of course almost never is the default browser ; and I have a dozen links. Instead of putting :
    Please Login or Register  to view this content.
    at each occurence of a link, is there a way to declare the use of Chrome in the header of the macro for all links?

    Thanks in advance for your help !
    Last edited by eawyne; 04-25-2023 at 07:54 AM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,532

    Re: Opening links through a macro using non-default browser

    You can rewrite the code like this (your code is just a fragment; I added some lines to make it compilable)

    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    11-11-2021
    Location
    France
    MS-Off Ver
    2021
    Posts
    17

    Re: Opening links through a macro using non-default browser

    Thanks, I'll try this shortly.

    Sorry for not posting more of the code, but security checks are kinda tight, and even sharing a mostly empty file can be troublesome...

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,532

    Re: Opening links through a macro using non-default browser

    Come to think of it you can put the shell command outside the Select.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-11-2021
    Location
    France
    MS-Off Ver
    2021
    Posts
    17

    Re: Opening links through a macro using non-default browser

    Argh, I just updated my first post ^^'

    I didn't have the code at hand when I posted, and the call for reaching the URL is written differently, like this :

    Please Login or Register  to view this content.
    meaning the Shell part doesn't work, it seems, with & Myurl ; it opens Edge as default (on this PC) to follow the link, and it also opens Chrome in the background, without following the link.

    So so sorry !
    Last edited by eawyne; 04-25-2023 at 08:32 AM.

  6. #6
    Forum Contributor
    Join Date
    10-02-2012
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    237

    Re: Opening links through a macro using non-default browser

    That's because you need to remove the instruction to use default browser. Remove the "ThisWorkbook.FollowHyperlink" parts, just use the Shell command.

  7. #7
    Registered User
    Join Date
    11-11-2021
    Location
    France
    MS-Off Ver
    2021
    Posts
    17

    Re: Opening links through a macro using non-default browser

    Okay, that's what I actually did as I needed to test it out ! So now it works smoothly.

    Thank you very much

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,532

    Re: Opening links through a macro using non-default browser

    If your question has been answered please mark your thread as "Solved" so that members will know by looking at the thread title that your problem is solved. Go to the menu immediately above your first post to the thread and click on Thread Tools. From the dropdown menu select "Mark this thread as solved..."

    Thanks for the rep!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Opening URL in existing instance of non-default browser
    By ByteMarks in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-30-2019, 08:20 AM
  2. Initializing Default Browser
    By billyshears in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-16-2013, 05:18 PM
  3. Some hyperlinks don't open in default browser
    By biznez1 in forum Excel General
    Replies: 0
    Last Post: 05-17-2013, 02:14 PM
  4. Replies: 1
    Last Post: 05-04-2012, 06:03 AM
  5. Any way to make Excel use a non-default browser?
    By Delta223 in forum Excel General
    Replies: 2
    Last Post: 07-30-2010, 03:00 AM
  6. Replies: 4
    Last Post: 05-18-2006, 11:25 PM
  7. Default browser for web querys?
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-09-2005, 08:06 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1