• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 558
  • Last Modified:

VB routine to find the version of MS Word

Hi  All,
 Does anyone know a VB routine that seraches and returns the MS Word version/s installed on a specific computer ?
 Cheers.
0
meperera
Asked:
meperera
  • 3
1 Solution
 
ArkCommented:
Private Sub Command1_Click()
   Dim wrd As Object
   Set wrd = CreateObject("Word.Application")
   MsgBox wrd.version
   Set wrd = Nothing
End Sub
0
 
mepereraAuthor Commented:
Thanks Ark,
  Do I Have to import any libraries  for this ? This Gives the version As 12.0 not 2007. Is there a way around that ?

Cheers.
0
 
ArkCommented:
Hi
1. No ned import any library - if MS Word instaled on computer, it return version number. To handle computers without MS Word:
Private Sub Command1_Click()
   Dim wrd As Object
   Set wrd = CreateObject("Word.Application")
   if wrd Is Nothing Then
      MsgBox "MS Word not found!"
   else
      MsgBox wrd.version
   end if
   Set wrd = Nothing
End Sub

2. 12.0 is a version number for MS Word 2007 (like 11.0 for 2003 and 10.0 for 2000)
0
 
ArkCommented:
PS. You can retrive version and then convert it into year string:
Private Sub Command1_Click()
   Dim wrd As Object
   Dim sVersion As String, sYearVersion As String
   Set wrd = CreateObject("Word.Application")
   if wrd Is Nothing Then
      MsgBox "MS Word not found!"
   else
      sVersion=wrd.version
      Select Case Left(sVersion,2)
                 Case "10": sYearVersion="MS Word 2000"
                 Case "11": sYearVersion="MS Word 2003"
                 Case "12": sYearVersion="MS Word 2007"
                 Case "13": sYearVersion="Future MS Word :)"
                 Case Else: sYearVersion="Ancient MS Word :)"
      End Select
      MsgBox sYearVersion
   end if
   Set wrd = Nothing
End Sub
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now