
Word 200 and Word 2002: VBA6 compiler constant does not do the job
I've run into the same, and similar problems many times, and I agree
with the ridiculousness of the situation. The only workaround I've
found is to place the Word 2002-specific code in a separate function;
the compiler only seems to 'compile' subs and functions that are
actually called.
For Example
Sub AllVersions()
Options.SmartCutPaste = False
If Val(Application.Version) >= 10 Then
DoWord10Stuff
End If
End Sub
Sub DoWord10Stuff()
Options.PasteSmartCutPaste = False
End Sub
This kind of code runs on Word 97/2000 and 2002 without compile
errors. It's a little ugly, but it works...
Peter Cooper
Quote:
> Has anybody found a means to distinguish between Word 2002 and Word 2000 VBA
> with a compiler constant.
> I find it difficult to believe that MSFT let this one slip by.
> I cannot compile code in Word 2000 that has any Word 2002 code not
> recognized by Word 2000.
> In some cases, I am able to write the code so I do not need the Word 2002
> feature.
> However, I cannot do that for features without adequate documentation.
> In any case, a proper built-in compiler constant would eliminate the need
> for such recoding.
> This situation arose because code written in Word 2000, does not work
> correctly in Word 2002, unless I add a modification of the
> PasteSmartCutPaste property. But if I add that property, then the code will
> not even compile in Word 2000.
> Given the ambiguous "documentation" (see separate thread in this newsgroup),
> I cannot guarantee that I can change the code to eliminate the need for
> PasteSmartCutPaste in Word 2002.