#1   Report Post  
Posted to microsoft.public.excel.programming
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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 270
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dual monitors GerryK Excel Discussion (Misc queries) 10 July 9th 08 09:58 PM
dual y axis SkyUser Charts and Charting in Excel 2 April 13th 07 12:31 AM
dual Y axis help [email protected] Charts and Charting in Excel 1 April 13th 06 12:48 PM
Dual x-axis ET Charts and Charting in Excel 2 June 15th 05 06:09 PM
="Z" dual use? Scott Calkins via OfficeKB.com Excel Worksheet Functions 5 May 5th 05 01:30 PM


All times are GMT +1. The time now is 05:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"