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

G

Guest

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,
 
R

Rick Rothstein \(MVP - VB\)

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
 
D

Debbie Horner

Can I just use that to say if version 11 save as xls else if version save as
xlm (or xlsm?)?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top