Results 1 to 4 of 4

Opening Multiple Hyperlinks in a range

Threaded View

randell.graybill Opening Multiple Hyperlinks... 04-03-2009, 11:02 PM
randell.graybill Re: Opening Multiple... 04-04-2009, 12:18 AM
Leith Ross Re: Opening Multiple... 04-04-2009, 12:21 AM
randell.graybill Re: Opening Multiple... 04-04-2009, 12:31 AM
  1. #1
    Forum Contributor
    Join Date
    04-03-2009
    Location
    USA, California
    MS-Off Ver
    Excel 2007
    Posts
    385

    Opening Multiple Hyperlinks in a range

    Ok so what I want to do is open all hyperlinks within a certain range (F2:F250) and if possible have the macro click on a button. Please note that this does not bypass any security, only presses the button which the username and password is stored already by the program in which I use, if there is no username and password in the box then the macro will fail.

    here is the code for the surrounding the button.

    <button class="HJSButton" type="submit" name="ctl00$ContentPlaceHolder1$LogOnButton" value="Logon" id="ctl00_ContentPlaceHolder1_LogOnButton"><img src="http://www.excelforum.com/images/tick.png" style="border-width:0px;" />&nbsp;Logon</button> 
    
     <button class="HJSButton" type="button" name="ctl00$ContentPlaceHolder1$ClearButton" value="Clear" onclick="ClearLogonForm();FocusFirstControl();" id="ctl00_ContentPlaceHolder1_ClearButton"><img src="http://www.excelforum.com/images/cross.png" style="border-width:0px;" />&nbsp;Clear</button>
    And here is the code I have so far trying to open the hyper links in a row. One final comment, the amount of hyperlinks in the spreadsheet will not always be the same therefore I need the macro to stop running once it runs out of links. The name of the spreadsheet that the hyperlinks will be activating from is 01DeliProduceRotations.xls
    Dim Pallets As Range, Cell As Object
         
        Set Pallets = Range("F2:F700") 'Range containing hyper links
          Pallets.Hyperlinks(2).Follow NewWindow:=False, Addhistory:=False
        Next
        Pallets.Hyperlinks.Follow NewWindow:=False, Addhistory:=False
        
       ' For Each Cell In Pallets
             
         '   If IsEmpty(Cell) Then
           '     Exit Sub
         '   End If
            
           '   If Cell.Value <> "" Then
               
           '                 Windows("01DeliProduceRotations.xls").Activate
               ' ActiveSheet.Range("A65536").End(xlUp).Select
                'Selection.Offset(1, 0).Select
                'ActiveSheet.Paste
                 
          '  End If
             '    Next
           
        End Sub
    This question was also post here. http://answers.yahoo.com/question/in...3185222AAvzNM3



    UPDATE:

    The following is the only way I would know how to open all hyperlinks in a spreadsheet. And this method of doing it would be very time consuming and bring this pre LGA775 P4 to its knees. Anyone able to help speed this process up? The whole auto logon part is not as important as this is. The ultimate goal of this macro will open all hyper links logon onto the site, export the crytal report, open the spreadhsheet from that crystal report, do a countA() on the cells in column F copy that data to the position the hyperlink was clicked at.

        Range("F2").Select
        Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
        Range("F3").Select
        Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
        Range("F4").Select
        Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
        Range("F5").Select
        Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
        Range("F6").Select
        Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
        Range("F7").Select
        Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
        Range("F8").Select
        Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
        Range("F9").Select
        Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
        Range("F10").Select
        Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
        Range("F11").Select
        Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
        Range("F12").Select
        Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
        Range("F13").Select
        Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
        Range("F14").Select
        Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
        Range("F15").Select
        Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
        Range("F16").Select
        Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
        Range("F17").Select
        Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
         Range("F18").Select
        Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
        Range("F19").Select
        Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
        Range("F20").Select
        Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
        Range("F21").Select
        Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
        Range("F22").Select
        Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
        Range("F23").Select
        Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
        Range("F24").Select
        Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
        Range("F25").Select
        Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True

    UPDATE2:

    A user on yahoo answers provided the following answer which from what I asked on that forum does what I asked but not really what I'm after.

    I want these hyperlinks to open one at a time, process two commands on the page it opens, do a couple commands on the sheet it opens close the sheet it opens then continue to the next hyper link. If this macro takes a long while to run to completion that is not a problem as it is now for me to manually check and update this information it takes 20+ minutes.

    All the information for what I talk about above in UPDATE2 is listed in post #4
    
       Dim Pallets As Range, Cell As Range
    
    Set Pallets = Range("F2:F700") 'Range containing hyper links
    
    For Each Cell In Pallets
    
    If IsEmpty(Cell) Then
    Exit Sub
    End If
    
    If Cell.Value <> "" Then
    Cell.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=False

    Update3:

    Another user on yahoo answers posted this answer(which is the better set of code and will either of them contribute to the overall goal I'm trying to achieve here?):

    Dim Cell As Range
    Dim r As Integer 'Last used row in column F
    On Error Resume Next
    
    'Last used row in column F
    r = Range("F65536").End(xlUp).Row
    
    For Each Cell In Range("F2:F" & r) 'Range containing hyperlinks
    Cell.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=False
    Next Cell
    Last edited by randell.graybill; 04-04-2009 at 01:15 AM.

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