Application Name differences between Excel 2003 and 2007

  • Thread starter Thread starter SteveM
  • Start date Start date
S

SteveM

My application exchanges info between Excel and a non-Office application. It
works fine in Excel 2003 because the ActiveWorkbook.Name it assigns to
ThisApp works when you get to AppActivate.

ThisApp = ActiveWorkbook.Name
.... 'programming sends commands to other app
AppActivate ThisApp 'come back to Excel
.... 'programming in Excel

However the ActiveWorkbook.Name assigned to ThisApp by Excel 2007 does not
work when you get to AppActivate. You get an 'object not found' error. It
does work if the first line is changed to read

ThisApp = ActiveWorkbook.Name & " [Compatibility Mode]"

How can I program to distinguish between the two Excel versions and format
ThisApp to correctly deliver the Excel workbook name to the AppActivate
command? Are there any other modes which I might have to contend with
(append to the Excel 2007 name to make it work)?
 
I bet that there are people running versions of excel that include a letter
suffix (xl2002 and prior).

I'd use something like:
if val(application.version) = 12 then

And to save typing

select case val(application.version)
case is = 12 : msgbox "you are using xl2007"
case is = 11 : msgbox "you are using xl2003"
...
end select

Val() makes it a numeric test, too.
 
So Stanley and Dave,

Now I can distinguish between Excel 2003 and 2007. Will 2007 >always<
require [Compatibility Mode] to be appended to the application.name to work
with AppActivate? Are there any other modes that might be required instead
(or even none at all), and if so, how do I determine them? I want to
account for all possible choices with programming to avoid errors.

Dave Peterson said:
I bet that there are people running versions of excel that include a letter
suffix (xl2002 and prior).

I'd use something like:
if val(application.version) = 12 then

And to save typing

select case val(application.version)
case is = 12 : msgbox "you are using xl2007"
case is = 11 : msgbox "you are using xl2003"
...
end select

Val() makes it a numeric test, too.
 
A few tests should let you know, right?
So Stanley and Dave,

Now I can distinguish between Excel 2003 and 2007. Will 2007 >always<
require [Compatibility Mode] to be appended to the application.name to work
with AppActivate? Are there any other modes that might be required instead
(or even none at all), and if so, how do I determine them? I want to
account for all possible choices with programming to avoid errors.
 
Back
Top