Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hyperlink written to worksheet produces error
I'm writing a subroutine to list all the worksheets in a
workbook on a new worksheet called, "List of Worksheets." Here is the code: For Each Wsh In Sheets strWshName = Wsh.Name If strWshName < "List of Worksheets" Then I = I + 1 Set RA = Range(Replace("B" & Str(I), " ", "")) RA.FormulaR1C1 = strWshName strAddress = Replace("'" & strWshName & "'! A1", " ", "") Wsh.Hyperlinks.Add _ Anchor:=RA, _ Address:=strAddress, _ TextToDisplay:=strWshName End If Next Wsh Teh problem is that when I click on the inserted links I get an error message: "Cannot open the specified file." Indeed, if I try to edit the hyperlink directly, the correct sheet address (e.g. 'Sheet2'!A1) is in the address field of the Edit Hyperlinks window but the "Link to" selection is "Existing File or web Page" rather than "Place in this document." How do I write the Hyperink.Add statement specify that the hyperlink is for a __place in the document__ and not a web address or a filename? Thanks. John Wirt |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Error on large Excel spreadsheet with VBA, written in '03 used inmixed '03 - '07 environment | Excel Discussion (Misc queries) | |||
Excel 2002 produces error in calculation. | Excel Discussion (Misc queries) | |||
Refresh produces #N/A error | Links and Linking in Excel | |||
Refresh produces #N?A error | Excel Discussion (Misc queries) | |||
CreateObject produces error | Excel Programming |