View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Matt Somers Matt Somers is offline
external usenet poster
 
Posts: 4
Default Preventing compile errors when referencing objects ehanced after 1997

Hey Guys and Gals:

I am using the Hyperlink object for an Excel application intended for
use on Excel 97 and Excel 2000. I developed the code in 2000 with
syntax like:

ActiveSheet.Hyperlinks.Add Anchor:=Selection Address:="",
SubAddress:="", ScreenTip:="This is it, yea"

...but oops, darn it.

In 1997, ScreenTip was not around..so I'm talking space shuttles when
the program's talking Kitty Hawk..so I tried (code below) and got a
"compile error"

if left(Application.version,1) <= 8 then

ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="",
SubAddress:=""

else

ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="",
SubAddress:="", ScreenTip:="This is it, yea"

end if

Compile error makes sense in retrospect. (but its always rush, rush,
rush and not much thinky, thinky, thinky)

Matt