0

I've found this code for Microsoft Visual Basic Editor that opens multiple links in excel. However, I can't cancel it when the range prompt appears. Any ideas?

    Sub OpenMultipleLinks()
 'From WindowsLoop
     Dim MultiLink As Hyperlink
     Dim SelectedRng As Range
     On Error Resume Next
     'Window Heading
     WLTitleId = "WL Open Multiple Links"
     'Set Range
     Set SelectedRng = Application.Selection
     Set SelectedRng = Application.InputBox("Range", WLTitleId, SelectedRng.Address, Type:=8)
     'Open Links One by One
     For Each MultiLink In SelectedRng.Hyperlinks
         MultiLink.Follow
     Next
 End Sub
BigBen
  • 46,229
  • 7
  • 24
  • 40
Evo
  • 61
  • 4
  • try checking for `If SelectedRng = Nothing` right after the `Set SelectedRng = Application.InputBox("Range", WLTitleId, SelectedRng.Address, Type:=8)` – Glenn G Dec 13 '21 at 15:30
  • This doesn't work. The code isn't recognized as correct. – Evo Dec 13 '21 at 15:40
  • Sorry it should have been `If SelectedRng Is Nothing Then.....` I've also added an answer with the code EDIT:(Well was in the process of doing so when the question was closed) – Glenn G Dec 13 '21 at 16:02

0 Answers0