单击Excel中的超链接是否在超链接地址中添加了25?



我正在使用Excel for Mac 2011。插入超链接(右键单击->编辑超链接(时,Excel正在将链接地址中的所有%20转换为空格。示例:

页面链接的正确格式/路径:
http://MyFictionalSite.com/nfl/query?sdql=team%20%3D%20Bears%20and%20p%3AD%20and%20DIV%20and%20p%3ARY%20%3C%20pp%3ARY%20%3C%20ppp%3ARY%20and%20season%20%3E%3D%201996

Excel将我的超链接地址转换为:
http://MyFictionalSite.com/nfl/query?sdql=team%3D熊和p%3AD和DIV以及p%3ARY%3C pp%3ARY%3 pp%3ARY和季节%3E%3D 1996

如果我将这两个链接中的任何一个直接复制粘贴到浏览器中,它们实际上都可以正常工作。这个问题是,当我在Excel中单击超链接时,链接会转换为:
http://MyFictionalSite.com/nfl/query?sdql=team%20%253D%20Bears%20and%20p%253AD%20and%20DIV%20and%20p%253ARY%20%253C%20pp%253ARY%20%253C%20ppp%253ARY%20and%20season%20%253E%253D%201996

为什么只有在点击excel超链接时才添加这些"25"?如何解决这个问题?像这样的一列中有100多个链接,我需要转换。

%25是字符串中百分比符号(%(的编码字符。

您可以通过将其他浏览器设置为默认浏览器来解决此问题,这样可以更好地处理它。或者,我们可以回到你最初的问题,看看我们是否能逃脱。

有关更多详细描述,请参阅下页:

https://searchmarketingcorner.wordpress.com/tag/excel-formulas/

原始问题:我无法在我的Excel版本上复制您的原始问题,但我们可以验证功能是否相同。

让我们试试这个(注意,你必须选择超链接才能运行,否则它什么都不做(:

Sub changepath()
' Select a range or column first.
Dim HyperLinkCount As Long
For HyperLinkCount = 1 To Selection.Hyperlinks.Count
Selection.Hyperlinks(HyperLinkCount).Address = Replace(Selection.Hyperlinks(HyperLinkCount).Address, " ", "%20")
Selection.Hyperlinks(HyperLinkCount).TextToDisplay = Replace(Selection.Hyperlinks(HyperLinkCount).Address, "%20", " ")
Next
End Sub

循环使用一个漂亮的excel函数"Selection.Hyperlinks.Count"来迭代可能的超链接。

然后我刚刚把我认为你想要的东西翻译成了给我输出的东西。

我在这个论坛页面上找到了一些这样的东西:

https://www.ozgrid.com/forum/forum/help-forums/excel-general/99473-vba-hyperlink-text-to-display

也许这只适用于此特定版本的Excel 2011 for Mac。但是,如果将所有"%20"或"(空格(替换为"+",则超链接将正常工作。

Sub changepath()
' Select a range or column first.
Dim HyperLinkCount As Long
For HyperLinkCount = 1 To Selection.Hyperlinks.Count
Selection.Hyperlinks(HyperLinkCount).Address = Replace(Selection.Hyperlinks(HyperLinkCount).Address, " ", "+")
Next
End Sub

最新更新