Excel宏打开URL 特殊字符#变了

首先打开EXCEL,点击左上角的"文件"按扭(07版的是的圆图标),打开选项,再点击自定义功能区(Customize Ribbon),在右边,把开发工具(Developer)前的打上勾,点确定打开开发工具。

在开发工具里选择insert一个按钮

https://jingyan.baidu.com/article/9113f81b0c19e22b3214c78e.html

按钮一的代码如下

ActiveWorkbook.FollowHyperlink Address:="http://www.baidu.com/production/#!finder_result?global=object-id&revs=latest&conf=no-configurations&text=", NewWindow:=True

而实际打开网页后发现     #!      变为%20_%20,导致网页打不开

修改代码为

Shell "C:Program FilesInternet ExplorerIEXPLORE.EXE http://www.baidu.com/production/#!finder_result?global=object-id&revs=latest&conf=no-configurations&text=", vbNormalFocus

  或者

Dim web As Object
    Set web = CreateObject("InternetExplorer.Application")
    web.Visible = True
    web.Navigate ("http://www.baidu.com/prodution/#!test=")

  

原文地址:https://www.cnblogs.com/allenfly/p/7426491.html