I can't give you an answer to fully cover both of the points you raise ... but hopefully this will get you going in the right direction. I'm assuming you are using a Windows device, BTW.
For point A 'current version of Chrome':
You can access the version (actually either the "File version" or the "Product version") with this Function
' ---------------------------------------------------------------------------------------------------------------------
' Purpose: Try to get a property of a file
' Parameter sFilePath (String): The full path to the file
' Parameter sPropertyName (String): The file property to get details for eg "Size", "Date accessed", "Product version"
' ... which properties are available depends on the file, the parent folder and the OS
' Parameter outsPropertyValue (String): If the file has such a property, will be updated to hold the property value
' Returns (Boolean): True if the property exists, False otherwise
' ---------------------------------------------------------------------------------------------------------------------
Private Function TryGetFileProperty(sFilePath As String, sPropertyName As String, ByRef outsPropertyValue As String) _
As Boolean
' for early binding, add a reference to 'Microsoft Shell Controls and Automation' and use the commented-out types
Dim oShellApp As Object ' Shell32.Shell
Dim oShellFolder As Object ' Shell32.Folder
Dim oShellFolderItem As Object ' Shell32.FolderItem
Dim lFileNameStart As Long
lFileNameStart = InStrRev(sFilePath, "\")
Set oShellApp = CreateObject("Shell.Application")
Set oShellFolder = oShellApp.Namespace(Left$(sFilePath, lFileNameStart))
Set oShellFolderItem = oShellFolder.Items.Item(Mid$(sFilePath, lFileNameStart + 1))
' file properties can only be accessed by index number, however, the index number (and therefore the maximum index
' number - here 350) can vary (by file / folder / Windows version?) so we iterate over all properties to find the
' one with a name that matches the supplied property name ... if we find the property with the supplied name, then
' return its value
Dim i As Long
For i = -1 To 350
If StrComp(oShellFolder.GetDetailsOf(oShellFolder.Items, i), sPropertyName, vbTextCompare) = 0 Then
outsPropertyValue = oShellFolder.GetDetailsOf(oShellFolderItem, i)
TryGetFileProperty = True
Exit Function
End If
Next i
End Function
... the Function is documented to explain what it does and how it does it so I won't go into it further other than to provide this usage example:
Sub ExampleUsage()
Const sFILE_PATH As String = "C:\Program Files\Google\Chrome\Application\chrome.exe"
Const sPROPERTY_NAME As String = "Product version"
Dim sPropertyValue As String
If TryGetFileProperty(sFILE_PATH, sPROPERTY_NAME, sPropertyValue) Then
Debug.Print sPROPERTY_NAME & " is " & sPropertyValue
Else
Debug.Print "Could not get the " & sPROPERTY_NAME
End If
End Sub
... on my device, this prints "Product version is 115.0.5790.110" to the Immediate window.
BTW, if you want to see all of the properties available for a particular file then use this:
Sub LogAllFileProperties(sFilePath As String, Optional bOnlyWithValidValue As Boolean = True)
' for early binding, add a reference to 'Microsoft Shell Controls and Automation' and use the commented-out types
Dim oShellApp As Object ' Shell32.Shell
Dim oShellFolder As Object ' Shell32.Folder
Dim oShellFolderItem As Object ' Shell32.FolderItem
Dim lFileNameStart As Long
lFileNameStart = InStrRev(sFilePath, "\")
Set oShellApp = CreateObject("Shell.Application")
Set oShellFolder = oShellApp.Namespace(Left$(sFilePath, lFileNameStart))
Set oShellFolderItem = oShellFolder.Items.Item(Mid$(sFilePath, lFileNameStart + 1))
Dim i As Long, sDetailName As String, sDetailValue As String
For i = -1 To 350
sDetailName = oShellFolderItem.Parent.GetDetailsOf(oShellFolder.Items, i)
sDetailValue = oShellFolderItem.Parent.GetDetailsOf(oShellFolderItem, i)
If Len(sDetailValue) > 0 Or (Not bOnlyWithValidValue And Len(sDetailName) > 0) Then
Debug.Print Format(i, "000") & ": '" & sDetailName & "' = '" & sDetailValue & "'"
End If
Next i
End Sub
... just pass it the full path to the file.
For point B 'downloading and installing ChromeDriver':
I can only point you in the direction of other SO answers such as this one for downloading.
Assuming you are doing this in order to use SeleniumBasic, I believe (happy to be corrected!) that ChromeDriver doesn't actually need to be 'installed' as such, only that the downloaded file needs to be unzipped (again there are a number of SO answers on unzipping for example this one) and then copied into the same folder as the SeleniumBasic type library file.