我正在嘗試在 Excel 中使用 VBA 實作 Google 搜索方法。我想在彈出視窗中輸入某些單詞/單詞,然后谷歌搜索單詞/單詞 另一個預定的短語。例如,如果我在彈出視窗中輸入“John Doe”,我希望谷歌搜索是“John Doe License and Registration”,而不必每次輸入某個名字時都輸入“License and Registration”。我被卡住了,真的不知道如何在我的代碼中添加“許可證和注冊”。
Private Sub CommandButtonSearch_Click()
Dim query As String
Dim search_string As String
Dim googleChromePath As String
query = InputBox("Enter your keyword", "Google Search")
search_string = Replace(query, " ", " ")
googleChromePath = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
Shell (googleChromePath & " -url http://google.com/search?q=" & search_string)
End Sub
這張圖片說明了它現在的樣子:https : //i.imgur.com/J2Xrk8l.png
這張圖片說明了我希望它的外觀:https : //i.imgur.com/iZKyxr1.png
非常感謝您為我提供的所有幫助!
uj5u.com熱心網友回復:
Private Const LicenseRegistration As String = " License and Registration"
Private Sub CommandButtonSearch_Click()
Dim query As String
Dim search_string As String
Dim googleChromePath As String
query = InputBox("Enter your keyword", "Google Search")
search_string = Replace(query, " ", " ") & LicenseRegistration
googleChromePath = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
Shell (googleChromePath & " -url http://google.com/search?q=" & search_string)
End Sub
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/398064.html
上一篇:創建Ingress時出現問題
下一篇:Excel:列數等于單元格值
