Forum Discussion
Rob_embry
May 29, 2020Copper Contributor
Creating hyperlinks to workbook tabs using VBA but not using the full file path name as the address?
I have created a contents list of all the tabs in the workbook using VBA code with hyperlinks. The problem is that if the file name changes, or it gets moved the hyperlink no longer works. If yo...
hynguyen
Jun 01, 2020Iron Contributor
Rob_embry Have you tried to wrap your codes with "With ThisWorkbook" and "End With"?
Alternatively if you want to use Hyperlink formula in your VBA:
With ThisWorkbook
ActiveCell.Formula = "=HYPERLINK('" & wSheet.Name & "'!A1," & Chr(34) & wSheet.Name & Chr(34) & ")"
End With