
Version specific/select code??
Hi, John,
If you're running the same macros in Word 97 and Word 2000/2002, you
might have some calls to functions in the later versions that don't
exist in the earlier one (e.g., Split, Join, and Replace functions were
all new in Word 2000).
To avoid having to write separate macros, you can use "conditional
compilation". This is based on the fact that the value VBA6 is defined
in Word 2000/2002 but is not defined in Word 97. You can use the special
statements that start with the # character to put in code that is or is
not "seen" by the VBA compiler depending on whether the value is
defined -- something like this:
#If VBA6 Then
MsgBox "Word 2000/2002" ' invisible to Word 97
#Else
MsgBox "Word 97" ' invisible to Word 2000/2002
#End If
For example, the 2000/2002 code might use the Split function, while the
Word 97 code uses a longer and slower equivalent that doesn't throw a
compilation error.
Is that what you're looking for?
--
Regards,
Jay Freedman
Microsoft Word MVP Word MVP FAQ site: http://www.mvps.org/word
Quote:
> Hi guy n gals,
> Is there a way for me to check which version of word is being run
> when i jstart up a VBA project? the problem is that the app behaves
> in strange ways depending on teh version used! Also I don't know
> much about Signature keys but the signed version will work with word
> 2k but not so well with word
> 97.
> Any help appreciated!
> john