标题: 旧题重温,只因无人解答:自动生成目录表 [打印本页] 作者: fannky 时间: 2008-11-14 08:34 标题: 旧题重温,只因无人解答:自动生成目录表 Private Sub Workbook_Open()
Dim S, I As Integer
S = Me.Worksheets.Count
Sheet1.Activate
Sheet1.Cells(1, 1) = "序号"
Sheet1.Cells(1, 2) = "名称"
For I = 1 To S - 1
Range("B" & I + 1).Hyperlinks.Add Anchor:=Range("B" & I + 1), Address:="", SubAddress:=ThisWorkbook.Sheets(I).Name + "!A1"
Sheet1.Cells(I + 1, 1) = I
Sheet1.Cells(I + 1, 2) = Me.Sheets(I).Name
Next I
End Sub
=====================================================
以上代码可以解决自动生成目录并链接到对应的Sheet
但是当工作表的名字中有特殊字符的时候其对应的超链接就会出错,那位大虾可以帮我解决啊?