Hi, I'm currently working on a drop-down menu in an Excel sheet that has links to web pages in it. When you click one of the options on the drop-down it takes you to that webpage. That part was simple enough: I used 2 columns, one for the name and one for the URL and placed the following code:
Everything worked with that! Now what I am trying to do is make it so that after you click a link, the ComboBox will go back to the default value (example: "Title"). To do that I added one more line of code:Private Sub MMBox_Click() Dim navURL navURL = MMBox.Value ActiveWorkbook.FollowHyperlink Address:=navURL, NewWindow:=True End Sub
That did everything that I wanted except I would get an error at the end of execution that Excel could not open the webpage. What it is doing is going through the code and opening the first webpage then when it populates the ComboBox with ListIndex 0 again it goes through the whole function AGAIN. I need it to not do that. To get a clearer idea of how my list is structured here is a short format example:Private Sub MMBox_Click() Dim navURL navURL = MMBox.Value ActiveWorkbook.FollowHyperlink Address:=navURL, NewWindow:=True MMBox.ListIndex = 0 End Sub
Title <blank cell>
Site 01 URL 01
Site 02 URL 02
Site 03 URL 03
Site 04 URL 04
The ComboBox displays the first column, but opens the URL in the second column. If you need more clarification don't hesitate to ask!
Bookmarks