1. 程式人生 > >Excel宏打開URL 特殊字符#變了

Excel宏打開URL 特殊字符#變了

-i navig global article result col 按鈕 art xpl

首先打開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=")

  

Excel宏打開URL 特殊字符#變了