PC Review


Reply
Thread Tools Rate Thread

Compile directive for 2000 to ignore 2003 commands

 
 
Roy
Guest
Posts: n/a
 
      5th Jun 2008
How Can I tell Excel 2000 to ignore VBA command that are not implemented in
2000, but in later version?

"#If VB6 Then" is 'TRUE' for 2000, 2002 and 2003, so I cannot use it. I want
to use the .mask feature on a command button in 2002 and 2003, but I want the
same code to compile under 2000 and ignore the .mask line.

With MenuItem
.Caption = "My Button"
.Mask = frmIcons.Image1.Picture
End With

Also 'Application.Version' doesn't work as a compiler directive.
I need a way for a # compiler command to distinguish between 2000 , 2002 and
Excel 2003.

 
Reply With Quote
 
 
 
 
Rob Bovey
Guest
Posts: n/a
 
      5th Jun 2008
"Roy" <(E-Mail Removed)> wrote in message
news:C6994D7E-7B28-4C7D-BB42-(E-Mail Removed)...
> How Can I tell Excel 2000 to ignore VBA command that are not implemented
> in
> 2000, but in later version?
>
> "#If VB6 Then" is 'TRUE' for 2000, 2002 and 2003, so I cannot use it. I
> want
> to use the .mask feature on a command button in 2002 and 2003, but I want
> the
> same code to compile under 2000 and ignore the .mask line.
>
> With MenuItem
> .Caption = "My Button"
> .Mask = frmIcons.Image1.Picture
> End With
>
> Also 'Application.Version' doesn't work as a compiler directive.
> I need a way for a # compiler command to distinguish between 2000 , 2002
> and
> Excel 2003.


Hi Roy,

There is no compiler variable that distinguishes among different
versions of Excel. What you'd need to do in this case is use late binding by
declaring MenuItem As Object and then use an Application.Version check to
determine which code to actually execute at run-time:

Dim MenuItem As Object

' Set the MenuItem variable here

MenuItem.Caption = "My Button"
If Val(Application.Version) > 9 Then
MenuItem.Mask = frmIcons.Image1.Picture
End If

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm


 
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
Directive of group - GPO Windows 2000 server =?Utf-8?B?Sm9zZSBSb2JlcnRv?= Microsoft Windows 2000 Active Directory 4 30th Jun 2007 12:48 AM
Win 2000 MS Word 2003 macro won't compile, error VB =?Utf-8?B?QkxlbWFu?= Microsoft Word Document Management 3 5th Nov 2006 01:52 AM
Logging VS.Net compile commands Jon Maz Microsoft ASP .NET 0 8th Oct 2004 01:12 PM
Logging VS.Net compile commands Jon Maz Microsoft Dot NET 0 8th Oct 2004 01:12 PM
RE: The 'Location' attribute is not supported by the 'OutPutCache' directive????when i set in the directive Andy Mortimer [MS] Microsoft ASP .NET 0 13th Feb 2004 10:32 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:09 PM.