Opening browser on a variable page using vbscript

前端 未结 4 678
猫巷女王i
猫巷女王i 2020-12-11 07:24

I\'m trying to write a bit of VBScript to open a browser on a specific webpage. Ultimately this webpage would be unique per script. At the moment I have the following code w

4条回答
  •  旧巷少年郎
    2020-12-11 07:59

    Can you pl insert "Call" prefix to "objShell.ShellExecute"

    Dim objShell
    Set objShell = CreateObject("Shell.Application")
    
    iURL = "www.google.com"
    
    Call objShell.ShellExecute("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", iURL, "", "", 1)
    

    For IE:

    'Call objShell.ShellExecute("iexplore.exe", iURL, "", "", 1)
    
    
    For more info below code also works,
    
    Dim objShell
    Set objShell = CreateObject("Shell.Application")
    

    chrome:

    iURL = "www.google.com"
    'objShell.ShellExecute "chrome.exe", iURL, "", "", 1
    

    ie:

    'objShell.ShellExecute "iexplore.exe", iURL, "", "", 1
    

提交回复
热议问题