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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
DoCmd.Close acReport, stDocName, acSaveYes
End Sub
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 ?
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.
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.
ASKER
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..
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..
Function GetVersion() As String
' Determine the version of Microsoft Access
' used to create this application.
GetVersion = SysCmd(acSysCmdAccessVer)
End Function
Jim.