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 Files\Internet Explorer\IEXPLORE.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=")

  

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章