Opening browser on a variable page using vbscript
browser, vbscript
Solution
No `As String` as VBScript is not strongly type, you need a `set` when you create an instance of the COM object & no parens around the method call;
Dim iURL
Dim objShell
iURL = "www.google.ie"
set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "chrome.exe", iURL, "", "", 1
Or if chrome is the default
set objShell = CreateObject("WScript.Shell")
objShell.run(iURL)
Problem
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 which works: ``` Dim objShell objShell = CreateObject("Shell.Application") objShell.ShellExecute("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", "www.google.ie", "", "", 1) ``` But I would like to get the following working: ``` Dim iURL As String Dim objShell iURL = "www.google.ie" objShell = CreateObject("Shell.Application") objShell.ShellExecute("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", iURL, "", "", 1) ``` Any ideas what it is I'm doing wrong? Any help would be greatly appreciated.