Results 1 to 6 of 6
  1. #1
    Bronze Lounger
    Join Date
    Sep 2007
    Posts
    1,203
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,

    I have a combo box from the forms toolbar with an input range of A1:A20. In B1:B20 I have hyperlinks to the web. How do I set up the code to follow the hyperlink to the right of the selected item in the list?
    Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Set the linked cell of the combo box to, say, cell G1.
    Attach the following macro to the combo box:

    Code:
    Sub GoWeb()
      ActiveWorkbook.FollowHyperlink Range("B1:B20").Cells(Range("G1"))
    End Sub
    The hyperlinks in B1:B20 should be fully formed, i.e. they should include http://

  3. #3
    Bronze Lounger
    Join Date
    Sep 2007
    Posts
    1,203
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks Hans.

    Is there any way to force the window open as maximized?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Not as far as I know. Users will have to set their browser to open maximized.

  5. #5
    Bronze Lounger
    Join Date
    Sep 2007
    Posts
    1,203
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hans,

    Slightly adapted as I forgot to mention that the list is on a peparate sheet from the drop down box.

    Can you see any reason why GoWeb() works perfectly with web links, but GoNavigate() does not work with links to other worksheets in the workbook. Clicking the links work correctly, but calling them from code do not.

    Code:
    Sub GoNavigate()
    
    Dim wb As Workbook
    Dim admin As Worksheet
    
    	Set wb = ActiveWorkbook
    	Set admin = wb.Worksheets("Admin")
    	
    	wb.FollowHyperlink admin.Range("B22:B41").Cells(admin.Range("B21"))
    		
    	admin.Range("B21") = 1
    
    End Sub
    
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    
    Sub GoWeb()
    
    Dim wb As Workbook
    Dim admin As Worksheet
    
    	Set wb = ActiveWorkbook
    	Set admin = wb.Worksheets("Admin")
    	
    	wb.FollowHyperlink admin.Range("B44:B63").Cells(admin.Range("B43"))
    	
    	admin.Range("B43") = 1
    
    End Sub

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    > the list is on a peparate sheet

    Shouldn't that be a "pepperoni" sheet?

    But seriously, without seeing the workbook I have no idea why one would work and the other wouldn't...

Posting Permissions

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