ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   2003--2007 recognize if i'm in 2007 or 2003 via code. (https://www.excelbanter.com/excel-programming/395351-2003-2007-recognize-if-im-2007-2003-via-code.html)

Miri

2003--2007 recognize if i'm in 2007 or 2003 via code.
 

hi,
i have macro that works on 2003, in run time, it opens an excel file, made
some changes and should save. i need the same macro to run on 2003 and 2007,
and save the file in .xls(in 2003) or .xlm(in 2007).
how should i recognize if i'm in 2007 or 2003 via the code?
and how should i re write the following code that was only for 2003:
ActiveSheet.SaveAs FileName:=ModelPath & "\" & "Service Request " & ".xls"
thanks,



--
Miri Tz.

Rick Rothstein \(MVP - VB\)

2003--2007 recognize if i'm in 2007 or 2003 via code.
 
i have macro that works on 2003, in run time, it opens an excel file, made
some changes and should save. i need the same macro to run on 2003 and
2007,
and save the file in .xls(in 2003) or .xlm(in 2007).
how should i recognize if i'm in 2007 or 2003 via the code?


If Application.Version = "11.0" Then
MsgBox "Using XL2003
ElseIf Application.Version = "12.0" Then
MsgBox "Using XL2007"
Else
MsgBox "Not using either XL2003 nor XL2007"
End If

Rick


Debbie Horner

2003--2007 recognize if i'm in 2007 or 2003 via code.
 
Can I just use that to say if version 11 save as xls else if version save as
xlm (or xlsm?)?

"Rick Rothstein (MVP - VB)" wrote:

i have macro that works on 2003, in run time, it opens an excel file, made
some changes and should save. i need the same macro to run on 2003 and
2007,
and save the file in .xls(in 2003) or .xlm(in 2007).
how should i recognize if i'm in 2007 or 2003 via the code?


If Application.Version = "11.0" Then
MsgBox "Using XL2003
ElseIf Application.Version = "12.0" Then
MsgBox "Using XL2007"
Else
MsgBox "Not using either XL2003 nor XL2007"
End If

Rick



Ron de Bruin

2003--2007 recognize if i'm in 2007 or 2003 via code.
 
Hi Debbie

See
http://www.rondebruin.nl/saveas.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Debbie Horner" wrote in message ...
Can I just use that to say if version 11 save as xls else if version save as
xlm (or xlsm?)?

"Rick Rothstein (MVP - VB)" wrote:

i have macro that works on 2003, in run time, it opens an excel file, made
some changes and should save. i need the same macro to run on 2003 and
2007,
and save the file in .xls(in 2003) or .xlm(in 2007).
how should i recognize if i'm in 2007 or 2003 via the code?


If Application.Version = "11.0" Then
MsgBox "Using XL2003
ElseIf Application.Version = "12.0" Then
MsgBox "Using XL2007"
Else
MsgBox "Not using either XL2003 nor XL2007"
End If

Rick





All times are GMT +1. The time now is 04:01 AM.

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