Thread: Dual Code
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sandy Sandy is offline
external usenet poster
 
Posts: 270
Default Dual Code

Given that some of my users might want to open my Workbook in 2003 or 2007
(or convert to a 2007 Workbook) is the following viable? and if so what code
do I have to attach within the asterisks, to identify the versions.

Private Sub Workbook_BeforeClose(Cancel As Boolean)

'other code

Application.DisplayFormulaBar=True

If **** application version is 95-2003 **** Then

With Application
.CommandBars("Worksheet Menu Bar").Enabled = True
.CommandBars("Standard").Visible = True
.CommandBars("Formatting").Visible = True
.CommandBars("Drawing").Visible = True
End With

ElseIf **** application version is 2007 **** Then

If Not ActiveWorkbook.Saved Then
If (MsgBox("Do you want to save your changes?", vbYesNo)) = 6 Then
ActiveWorkbook.Save
Else
ActiveWorkbook.Saved = True
End If
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",True)"
Application.DisplayFormulaBar = True

End If

'other code

End Sub

Thanks
Sandy