+ Reply to Thread
Results 1 to 4 of 4

Need to follow hyperlinks in selection

Hybrid View

  1. #1
    Registered User
    Join Date
    05-23-2007
    Posts
    3

    Need to follow hyperlinks in selection

    I've got numerous hyperlinks in a row. I would like to select some of them, say 10, and then run a macro that will follow each of them opening 10 windows to each URL. I'm trying to use the following macro:

    Sub followLink()
    '
    ' Keyboard Shortcut: Ctrl+f
    '
    On Error Resume Next
    For Each Cell In Selection
    Cell.Hyperlink.Follow
    ' I also tried Cell.Hyperlinks(1).Follow, but this also does nothing
    Next Cell
    On Error GoTo 0
    End Sub

    I don't get an error, however no browser windows open. If I click on individual hyperlinks a browser window opens as expected.

    Can anyone help me figure out how follow muliple links with a single click?

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Gregorydarmohra,

    This code work for me. The True argument indicates that each hyperlink is to open in a new window.
      For Each Cell In Selection
        ' Check that the cell contains a hyperlink
          If Cell.Hyperlinks.Count > 0 Then
             Cell.Hyperlinks(1).Follow (True)
          End If
      Next Cell
    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    05-23-2007
    Posts
    3

    Still can't get it to work

    Leith, thank you for your post and sample script. I tried your script and still no luck. When I select a single cell, two cells, or multiple cells some with and some with hyperlinks, I don't get any popup browser windows. I try both running the macro from Tools>Macro and also by the Control-F shortcut I've set.

    Can you help me figure out why it's not working for me? Are there debug statements I can insert? Is it a security setting?

    Thanks in advance for your help.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Gregorydarmohra,

    My default browser is Internet Explorer. If your's is different that may have something to do with your problem. If you are using a different browser, change your default to Internet Explorer.

    Seems if there any security issues, you would receive a warning. If you have a firewall check if it will let these types of scripts run. What version of Windows and Office are you using?

    Sincerely,
    Leith Ross

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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