Find version and version of MS Office using VBA

the major and minor versions of the office application can be found using Application.Version

.

Return examples:

15.0 = Office 2013
12.0 = Office 2007

      

I need a revision and assembly version of an office application, for example:

Microsoft Office PowerPoint 2007 Original: major.minor: 12.0

revision.build: 4518.1014

Microsoft Office PowerPoint 2007 Service Pack 2 (SP2): major.minor: 12.0

revision.build: 6425.1000

Question . Is there a way to find the version and build version of an office application using VBA ?

The question has been updated . Naming convention error on my side. Looking for the version and version of the office application version, not the minor version.

+3


source to share


1 answer


VBA doesn't have a function to do it directly, you need 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 by chkref.name

+3


source







All Articles