On some devices, Chrome is installed to ../Program Files (x86)/.. while on others it’s ../Program Files/.. This microservice helps you find the correct path.
PathToChrome
Function PathToChrome()
Dim PathToTry As String
PathToTry = "C:\Program Files\Google\Chrome\Application\chrome.exe"
If Dir(PathToTry) <> "" Then PathToChrome = PathToTry: Exit Function
PathToTry = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
If Dir(PathToTry) <> "" Then PathToChrome = PathToTry: Exit Function
End Function
Examples
=PathToChrome()
If you place the above formula into cell A1, that cell shows “C:\Program Files\Google\Chrome\Application\chrome.exe” if Chrome has been installed in \Program Files\ and “C:\Program Files (x86)\Google\Chrome\Application\chrome.exe” if Chrome has been installed in \Program Files (x86)\