ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Was workbook opened with Excel 2007? (https://www.excelbanter.com/excel-programming/404285-workbook-opened-excel-2007-a.html)

Mike

Was workbook opened with Excel 2007?
 
I have a workbook with formulas that only work in Excel '07 (using the
iferror function). When the workbook is opened, I want to check if the user
opened it with an earlier version of Excel. If they did, I want to tell them
to open it with Excel '07 and then automatically close the workbook.

I think I can handle writing all of the code except the part where I check
what version of excel they are using. The only member of the Application
object that I found which might be useful was Application.Version, but I
don't know if this can be trusted (returns 12.0 for me).

Has anyone else written code to perform the above validation? I would
rather not change all of my functions to include IF stmts instead of
IFERROR...

Gary Keramidas[_2_]

Was workbook opened with Excel 2007?
 
should be fine.

Option Explicit

Private Sub Workbook_Open()
If Application.Version < 12 Then
MsgBox "whatever you want to say"
ActiveWorkbook.Close savechanges:=False
End If
End Sub
--

Gary


"Mike" wrote in message
...
I have a workbook with formulas that only work in Excel '07 (using the
iferror function). When the workbook is opened, I want to check if the
user
opened it with an earlier version of Excel. If they did, I want to tell
them
to open it with Excel '07 and then automatically close the workbook.

I think I can handle writing all of the code except the part where I check
what version of excel they are using. The only member of the Application
object that I found which might be useful was Application.Version, but I
don't know if this can be trusted (returns 12.0 for me).

Has anyone else written code to perform the above validation? I would
rather not change all of my functions to include IF stmts instead of
IFERROR...



Mike

Was workbook opened with Excel 2007?
 
Didn't think there was any way it was that simple. Thanks!!!

"Gary Keramidas" wrote:

should be fine.

Option Explicit

Private Sub Workbook_Open()
If Application.Version < 12 Then
MsgBox "whatever you want to say"
ActiveWorkbook.Close savechanges:=False
End If
End Sub
--

Gary


"Mike" wrote in message
...
I have a workbook with formulas that only work in Excel '07 (using the
iferror function). When the workbook is opened, I want to check if the
user
opened it with an earlier version of Excel. If they did, I want to tell
them
to open it with Excel '07 and then automatically close the workbook.

I think I can handle writing all of the code except the part where I check
what version of excel they are using. The only member of the Application
object that I found which might be useful was Application.Version, but I
don't know if this can be trusted (returns 12.0 for me).

Has anyone else written code to perform the above validation? I would
rather not change all of my functions to include IF stmts instead of
IFERROR...





All times are GMT +1. The time now is 09:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com