我的Excel中有一个VB,它从粘贴的单元格中提取超链接:
Function GetAddress(HyperlinkCell As Range) As String
If HyperlinkCell.Hyperlinks.Count > 0 Then
GetAddress = Replace(HyperlinkCell.Hyperlinks(1).Address, "mailto:", "NOTHING HERE")
Else
GetAddress = ""
End If
End Function
问题是它在#之后剥离了超链接中的任何内容
http://en.wikipedia.org/wiki/Technical_support#Tier.2FLevel_1_.28T1.2FL1.29
变为
http://en.wikipedia.org/wiki/Technical_support
有关如何请求整个字符串的任何建议吗?
答案 0 :(得分:0)
怎么样:
Function GetAddress(HyperlinkCell As Range) As String
If HyperlinkCell.Hyperlinks.Count > 0 Then
GetAddress = Replace(HyperlinkCell.Hyperlinks(1).Address, "mailto:", "NOTHING HERE")
GetAddress = GetAddress & "#" & HyperlinkCell.Hyperlinks(1).SubAddress
Else
GetAddress = ""
End If
End Function