Page tree
Skip to end of metadata
Go to start of metadata

Summary

The API includes version information in two locations. The information associated with the MWOffice object provides the version of the currently running application. The information associated with the MWOffice.Project object provides the version that created that Project. So to get the Version and Build number of the application that created a project we need to get the values from the Project object. Let's look at a quick script sample that opens a project and compares the project version information with the version of the running application. Special Note, this script will need to be created in the Script (Global.mws) section of the script editor because we are going to be closing the current project and loading a new one, any scripts associated with the current project will be closed when the project is closed.

Code Snippets

 ' Code Module
Sub Main
     Dim opened As Boolean
     opened = MWOffice.Open("C:\MyProject.emp")

     Debug.Clear

     If (opened) Then
          Debug.Print "Project Version = " & MWOffice.Project.AppVersion;
          Debug.Print "  Project Build = " & MWOffice.Project.BuildNumber

          Debug.Print "Application Version = " & MWOffice.Version;
          Debug.Print "  Application Build = " & MWOffice.BuildNumber

     End If

End Sub
 

Running this script on a project created in 7.5 provides the following output:

Project Version = 750  Project Build = 3664
Application Version = 8  Application Build = 3910

Here the project version is 750 indicating it was created with 7.50 build 3664 and the application which is a floating point value provides the version as 8.0 build number 3910. So from these properties we can determine the build number and version the project was created with and the version of the application currently running that project.