PC Review


Reply
Thread Tools Rate Thread

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

 
 
=?Utf-8?B?TWlyaQ==?=
Guest
Posts: n/a
 
      13th Aug 2007

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.
 
Reply With Quote
 
 
 
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      13th Aug 2007
> 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

 
Reply With Quote
 
Debbie Horner
Guest
Posts: n/a
 
      15th Oct 2008
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
>
>

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      15th Oct 2008
Hi Debbie

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

--

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


"Debbie Horner" <(E-Mail Removed)> wrote in message news:6F84ED5E-E16F-4DFC-AFDE-(E-Mail Removed)...
> 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
>>
>>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
2007 Code in 2003 Kay Microsoft Access VBA Modules 3 3rd Mar 2010 09:46 PM
function in 2003 not recognize access 2007 ALLILOUYA Microsoft Access VBA Modules 1 19th Mar 2009 04:23 PM
Fast code in 2003 = agonizingly slow code in 2007 XP Microsoft Excel Programming 24 21st Oct 2008 01:01 PM
2003 2007 Code Derek Hart Microsoft Excel Programming 4 28th May 2008 01:48 AM
how enable BCM 2007 to recognize bcm 2003 data base? =?Utf-8?B?U2V5bW91cg==?= Microsoft Outlook BCM 5 25th Jul 2007 06:09 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:33 PM.