Microsoft Excel Version Validate :
Private Sub GetExcelVersions()
Dim _excelPath As String = GetComponentPath(OfficeComponent.Excel)
If Not GetMajorVersion(_excelPath) = 12 Then
System.Windows.MessageBox.Show("Please Note: Only Computers which are using Microsoft Excel 2007 can use this Application at this time. The Application will be closed.", "Microsoft Excel Version In Use Is Not Supported", MessageBoxButton.OK, MessageBoxImage.Exclamation)
End
End If
End Sub
Private Function GetMajorVersion(ByVal _path As String) As Integer
Dim toReturn As Integer = 0
If File.Exists(_path) Then
Try
Dim _fileVersion As FileVersionInfo = FileVersionInfo.GetVersionInfo(_path)
toReturn = _fileVersion.FileMajorPart
Catch
End Try
End If
Return toReturn
End Function