Determining the version of Microsoft Office from LotusScript

April 21 2007

So I saw a posting on the LDD Notes 6 & 7 forum on how to determine the version of Microsoft Office installed on the user's machine via LotusScript. The way that I do it is with a custom function I wrote:



Function OfficeVersion As String
     On Error Goto ErrorHandling
                     
             Dim hwd as variant

     Print "Checking Version of Microsoft Office ..."
     
     Set hwd = CreateObject("Word.Application")
     
     If hwd.version = "9.0" Then
             OfficeVersion =  "2000"
     Elseif hwd.version = "10.0" Then
             OfficeVersion =  "XP"
     Elseif hwd.version = "11.0" Then
             OfficeVersion =  "2003"
             Elseif hwd.version = "12.0" Then
             OfficeVersion =  "2007"
     Else
             OfficeVersion =  "Unsupported Version"
     End If
     
     hwd.quit
     
     Goto Bye
     
ErrorHandling :
     
     OfficeVersion = "False"
     Resume Bye    
     
Bye:        

  hwd.Quit
  delete hwd
     
End Function


This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.


Note - I removed our error logging code .. you should have some in all your apps. If you do not have your own, use OpenLog!

So how do I use this function? Something like this:



Dim officeversionvalue as string

officeversionvalue = OfficeVersion()

Select Case officeversionvalue
Case "2000"
  'do somethinig for Office 2000
Case "XP"
  'do somethinig for Office 2000
Case "2003"
  'do somethinig for Office 2000
Case "2007"
  'do somethinig for Office 2000
End Select


This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.


This is very useful for things like mail merge and other things where code is version dependant.

2 Responses to “Determining the version of Microsoft Office from LotusScript”

  1. 1) frank fernandis says:

    With Microsoft Office Outlook running, press and hold CTRL while you right-click the Outlook icon in the notification area, at the far right of the taskbar.

  2. 2) John Head says:

    Frank, that works great when YOU want to figure out the version, but not when you need to determine it programaticaly, That was why I posted my solution. Thanks for the comment!

Leave a Reply