动态 url 浏览 chrome vba
dynamic url to browse chrome vba
根据[this link][1],@ray使用以下代码进行浏览
shell("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe -url www.google.com")
虽然我想使用动态 url
Dim url as string
url = "www.google.com/translate"
Dim wholeContent as String
wholeContent = ""C:\Program Files (x86)\Google\Chrome\Application\chrome.exe - url"" & url
Shell(wholeContent)
下次可能是地图而不是翻译。
这是一个子程序,用于在 Chrome(32 位或 64 位版本)中打开 url,或者如果找不到 Chrome,则使用默认浏览器。希望对您有所帮助。
Sub OpenInChromeOrDefaultBrowser(ByVal url As String)
Dim wholeContent As String
chrome = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
If Dir(chrome, vbNormal) <> "" Then
'' 32 bit Chrome
wholeContent = """" & chrome & """ -url " & url
Else
'' 64 bit Chrome
chrome = "C:\Program Files\Google\Chrome\Application\chrome.exe"
wholeContent = """" & chrome & """ -url " & url
End If
If Dir(chrome, vbNormal) <> "" Then
'' Chrome is found, execute
Shell wholeContent
Else
'' Chrome was not found, open url using the default program
Dim Sh As Object
Set Sh = CreateObject("WScript.Shell")
Sh.Run url
End If
End Sub
根据[this link][1],@ray使用以下代码进行浏览
shell("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe -url www.google.com")
虽然我想使用动态 url
Dim url as string
url = "www.google.com/translate"
Dim wholeContent as String
wholeContent = ""C:\Program Files (x86)\Google\Chrome\Application\chrome.exe - url"" & url
Shell(wholeContent)
下次可能是地图而不是翻译。
这是一个子程序,用于在 Chrome(32 位或 64 位版本)中打开 url,或者如果找不到 Chrome,则使用默认浏览器。希望对您有所帮助。
Sub OpenInChromeOrDefaultBrowser(ByVal url As String)
Dim wholeContent As String
chrome = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
If Dir(chrome, vbNormal) <> "" Then
'' 32 bit Chrome
wholeContent = """" & chrome & """ -url " & url
Else
'' 64 bit Chrome
chrome = "C:\Program Files\Google\Chrome\Application\chrome.exe"
wholeContent = """" & chrome & """ -url " & url
End If
If Dir(chrome, vbNormal) <> "" Then
'' Chrome is found, execute
Shell wholeContent
Else
'' Chrome was not found, open url using the default program
Dim Sh As Object
Set Sh = CreateObject("WScript.Shell")
Sh.Run url
End If
End Sub