Results 1 to 9 of 9
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    2,095

    Determine Current Installed Version of Office


    Is there a way to determine the current version of Office other than to exhaustively look for directories Office11, Office12, Office14...........etc. Clearly advances in versions would render such searches as useless.

  2. #2
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    2,095
    Actually I'm wanting to know the directory for winword.exe, as my app needs to shell to word.

  3. #3
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    I use the Version property to determine the version of Access.
    msgbox Application.Version

    However, that is not a guarantee that Word is the same version. I would check for the existence of the directory. Maybe loop through iterations of a string to see if the directory exists. Maybe something like the following will bring the latest version\upgrade.

    Code:
    dim strPath as string
    dim strOfficePath as string
    
    for i = 11 to 20
    
    strPath = "Some\Directory\Office" & i & "\More stuff to find Word"  
      
    If Dir(strPath, vbDirectory) > "" Then
          strOfficePath = strPath
    end if
    
    next i

  5. #5
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    2,095
    Yes, I had already tested some code like what you've offered but had the concern that someday Microsoft would depart from the use of OFFICExx as their sub-directory of "Microsoft Office". I don't like sending apps out that have such exposures.

    Thanks,
    Bill

  6. #6
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    2,095
    Yes, I had already tested some code like what you've offered but had the concern that someday Microsoft would depart from the use of OFFICExx as their sub-directory of "Microsoft Office". I don't like sending apps out that have such exposures.

    Thanks,
    Bill

  7. #7
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    2,095
    I settled on this approach:

    Code:
    Option Compare Database
    Option Explicit
    Private Sub TestFindPath()
    Dim strWORDexePath As String
    
    strWORDexePath = WORDpath()    'App wan'ts to open AandB.doc in WORD, so where is WORD?
    
        If strWORDexePath = "" Then
            MsgBox "Unable to locate Microsoft WORD application." & vbNewLine & _
                   "Please open WORD manually to file AandB.doc manually."
        Else
            MsgBox strWORDexePath
        End If
        
    End Sub
    
    Public Function WORDpath() As String
    '*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
    ' Nominal directory for Microsoft Office (32 bit version) is:
    ' "c:\Program Files (x86)\Microsoft Office\OFFICExx\" where "xx" corresponds to the version of Microsoft Office.
    ' We limit our search to that hierarchy beginning with Office 2003 (OFFICE11) and return a zero
    ' length string if WINWORD.EXE isn't found, letting using program decide what to do.
    '*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
    Dim I As Integer
    Dim strWORDpath As String
    Dim strTESTpath As String
    WORDpath = ""               ' Return a zero length string if loop doesn't find WINWORD.exe
    
        For I = 11 To 20
        strTESTpath = "c:\Program Files (x86)\Microsoft Office\Office" & I & "\winword.exe"
        strWORDpath = Dir(strTESTpath)
            If strWORDpath > "" Then
                WORDpath = strTESTpath     ' Okay, we found it
                Exit For
            End If
        Next I
    
    End Function

  8. #8
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Not sure you will be able to do much better than that. I believe you are trying to avoid late binding, but you could use late binding and open a hidden instance of Word. Then you could check the Object's .Version property. Maybe do something like this at time of setup and store the value in a table.

  9. #9
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    2,095
    I think I'll let "sleeping dogs lie" at this point.

    While the app has extensive facilities builtin to update back-end DB's in the filed with any version updates that affect DB structure, it would be easier to deal with field complaints in the unlikely event that Microsoft changes their directory hierarchy. I will update the code to also search "Program Files" should anyone happen to install a 64bit version of Office in the future.

    Thanks,
    Bill

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 0
    Last Post: 03-03-2014, 06:56 AM
  2. Replies: 2
    Last Post: 01-08-2014, 08:52 AM
  3. Replies: 4
    Last Post: 10-15-2013, 11:33 AM
  4. Replies: 2
    Last Post: 08-16-2012, 05:14 PM
  5. Replies: 4
    Last Post: 05-30-2012, 07:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums