StringAndBranes
New Member
- Joined
- Feb 24, 2019
- Messages
- 4
Hello and just a thanks to everyone in advance . I am using Excel 2010, old but it suits my needs I need someones assistance on how to open a Hyperlink with a subaddress. See below and please advise:
(01) In the active workbook, I am able to create a hyperlink with a sub address (see below) that refers to a separate unopened Workbook called "Toggle Sort Columns.xlsm" that has the worksheet called WWWWWWW that has the cells D8:F10. When I am in the workbook that created the link, I can open the link pointing to the subaddress in the separate workbooks' worksheet (I placed the created link in a cell and was able to click on the cell that contained the link).
Hyperlink created:
(a) C:\ZZZ\ZZZ\Zzzz\TOGGLE SORT COLUMNS.xlsm - WWWWWWW!D8:F10
(b) Code:
(02) Issue: In a separate workbook (not previously mentioned) I placed the hyperlink (See 01a above) into a worksheet and show it in a forms' listbox. Note: When I click on the link in the worksheet it opens the hyperlink pointing to the subaddress. When I select the listbox item with the link (See 01a above) I get "Error -2147221014 Can Not Open The File".
(c) Code used to open:
Note: Fileloc has the below:
C:\ZZZ\ZZZ\Zzzz\TOGGLE SORT COLUMNS.xlsm - WWWWWWW!D8:F10
(01) In the active workbook, I am able to create a hyperlink with a sub address (see below) that refers to a separate unopened Workbook called "Toggle Sort Columns.xlsm" that has the worksheet called WWWWWWW that has the cells D8:F10. When I am in the workbook that created the link, I can open the link pointing to the subaddress in the separate workbooks' worksheet (I placed the created link in a cell and was able to click on the cell that contained the link).
Hyperlink created:
(a) C:\ZZZ\ZZZ\Zzzz\TOGGLE SORT COLUMNS.xlsm - WWWWWWW!D8:F10
(b) Code:
Code:
Sheets("Create Hyperlink").Hyperlinks.Add _
Anchor:=Sheets("Create Hyperlink").Range("A1"), _
Address:=Sheets("Create Hyperlink").Range("PathandFileNm"), _
SubAddress:=Sheets("Create Hyperlink").Range("FileWksName") & "!" & Range("FileRange"), _
TextToDisplay:=""
(c) Code used to open:
Code:
' BELOW WORKS ON URL'S BUT CAN'T GET IT TO WORK ON SUBADDRESS
Dim FileLoc As String
'
FileLoc = LbSelItems_Array(i, 3)
ThisWorkbook.FollowHyperlink (FileLoc)
Exit For
' ABOVE WORKS ON URL'S BUT CAN'T GET IT TO WORK ON SUBADDRESS
C:\ZZZ\ZZZ\Zzzz\TOGGLE SORT COLUMNS.xlsm - WWWWWWW!D8:F10