Link to home
Start Free TrialLog in
Avatar of terpsichore
terpsichore

asked on

Detect Version of Office within Access 2007 code

Based on which version of Office (2007 or 2010) that a user has installed on the local machine, I need to take certain action. Is there any easy way to detect this?
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
There's also the SYSCMD call:

Function GetVersion() As String
' Determine the version of Microsoft Access
' used to create this application.

      GetVersion = SysCmd(acSysCmdAccessVer)

End Function


Jim.
Ditto to @capricorn1

If Application.Version > 11 Then
    'because this is the use I have for knowing if things are A2007+
    'sub in what you need
    Call SaveAsOfficePDF(stDocName)
    Exit Sub
End If

'--------------------------------------------------------------------------
Private Sub SaveAsOfficePDF(stDocName As String)
Dim FormatValue As String
If Application.Version > 11 Then
    FormatValue = "PDF Format (*.pdf)"
Else
    FormatValue = acFormatRTF
End If
'yes if it's RTF the file ending will be screwy--but it should never get that far anyway
DoCmd.OpenReport stDocName, acPreview
DoCmd.OutputTo acOutputReport, stDocName, FormatValue, "c:\tempPdf\" & Reports(stDocName).Caption & ".pdf"
DoCmd.Close acReport, stDocName, acSaveYes
End Sub
Avatar of terpsichore
terpsichore

ASKER

just to be clear - I need the application installed on the machine, NOT the version of the application that created this Access app... please confirm solution if you would. Thanks.

 BTW, if you need the build number (which includes service packs and hotfixes), see the procedure here:

http://allenbrowne.com/ser-53code.html

Jim.
just to be clear,
what is your intention after you found the version installed on the machine?

you need to run a .bat file ?
Confirmed
Application.Version detects the running version of MS Access.
It is not concerned with the mdb or Accdb file type, but rather the version of the executable.
excellent dialog with the group, very insightful and quick.
terpsichore,

you could have split the points for the comments that have given you more info..

click on Request Attention and ask that the thread be reopen to allocate points properly..