Problems with xl97 & xl2K

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

Hi

I have a version problem. The following script creates an icon on the
toolbar. The problem is, that Excel 97 and Excel 2000 cannot handle the
..Picture property.

Private Sub SetIcon(cbrCtrl As CommandBarButton, shpPict As Shape, shpMask
As Shape)
Dim oMask As StdPicture

If Val(Application.Version) <= 9 Then
shpPict.Copy
cbrCtrl.PasteFace
Else
shpMask.CopyPicture xlScreen, xlBitmap
cbrCtrl.PasteFace
Set oMask = cbrCtrl.Picture
shpPict.CopyPicture xlScreen, xlBitmap
cbrCtrl.PasteFace
cbrCtrl.Mask = oMask
End If

Application.CutCopyMode = False

End Sub

How to program this code without a compile error?

Tom
 
put the code in the second leg of the if statement in a separate sub and
don't comile. Call the sub if the version so dictates.
 
Is it not possible to use something like that:

#If VB6 Then
....

or

#If ccXL2K Then
....


Tom
 
No it isn't. xl2000 and greater would evaluate to True for #if VBA6

Unless you want to manually alter your code to define your own constant,
there is no predefined constant that will identify xl2000 from xl2002 (or
xl2003).

You can separate xl97 from xl2000 and later that way, but not xl97 and
xl2000 separate from xl2002 and later.
 
Back
Top