Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dual Code
The key is the Application.Version, which returns a String value...
If CLng(Application.Version) < 12 Then ' Excel 2003 or earlier Else ' Excel 2007 (or, for the future, above) End If Rick "Sandy" wrote in message ... 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dual Code
Excellent Rick - Thank you
Sandy "Rick Rothstein (MVP - VB)" wrote in message ... The key is the Application.Version, which returns a String value... If CLng(Application.Version) < 12 Then ' Excel 2003 or earlier Else ' Excel 2007 (or, for the future, above) End If Rick "Sandy" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Dual monitors | Excel Discussion (Misc queries) | |||
dual y axis | Charts and Charting in Excel | |||
dual Y axis help | Charts and Charting in Excel | |||
Dual x-axis | Charts and Charting in Excel | |||
="Z" dual use? | Excel Worksheet Functions |