The major and minor version of an office application can be found using Application.Version
.
Return examples:
15.0 = Office 2013
12.0 = Office 2007
I require the revision and build version of the office application, example:
Microsoft Office PowerPoint 2007 Original: major.minor: 12.0
revision.build: 4518.1014
Microsoft Office PowerPoint 2007 SP2: major.minor: 12.0
revision.build: 6425.1000
Question: Is there a way of finding the revision and build version of an office application, using VBA?
Question updated: Naming convention mistake on my side - Looking for the revision and build version of an office application, not the minor version.
VBA does not have a function to do it directly, you will have to write a function to do it:
Public Sub test()
Dim version As String
Dim chkref As Object
' List of references
For Each chkref In ThisWorkbook.VBProject.References
version = RetrieveDllVersion(chkref.fullpath)
major = RetrievePart(version, 0)
majorup = RetrievePart(version, 1)
minor = RetrievePart(version, 2)
minorup = RetrievePart(version, 3)
MsgBox chkref.Name & " : " & major & "." & majorup & "." & minor & "." & minorup
Next
End Sub
Private Function RetrieveDllVersion(ByVal dll As String) As String
Dim fso As Object 'Scripting.FileSystemObject
Set fso = CreateObject("Scripting.FileSystemObject")
RetrieveDllVersion = fso.GetFileVersion(dll)
End Function
Private Function RetrievePart(ByVal version As String, ByVal pos As Integer) As String
RetrievePart = Split(version, ".")(pos)
End Function
Filter Excel / Office / Word on the chkref.name
Summary of alternatives :
Application.Version "16.0"
Application.Build "16.0.8431"
Application.BuildFull "16.0.8431.0"
CreateObject("Scripting.FileSystemObject") _
.GetFileVersion(Application.Path & "\WINWORD.exe") "16.0.8431.2280"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With