Tony
Mon Mar 19 09:01:08 CDT 2007
There is no conditional compiler constants for any Word version so, although
you can have conditionally compiled code you can not have Word version as
(part of) the condition.
Depending on exactly what it is you want to code you may be able to use
CallByName to include Word 2003 properties and methods in Word 2002 code -
because they are passed to CallByName as strings and, effectively, compiled
on demand subject to a condition (Application.Version) which will compile in
all versions.
--
Enjoy,
Tony
"Mike Faulkner" <MikeFaulkner@discussions.microsoft.com> schreef in bericht
news:663181D0-8B8D-44EF-84C1-C3CE4A4E9E21@microsoft.com...
> Jean-Guy
>
> Many thanks for you assistance. I am testing it using 'Conditional
> Compilation Arguements'.
>
> Regards
> Mike
>
> "Jean-Guy Marcil" wrote:
>
>> Mike Faulkner was telling us:
>> Mike Faulkner nous racontait que :
>>
>> > Hello
>> >
>> > OS: Windows XP
>> > App:Word XP
>> >
>> > Can I mark a section of VBA that will not be compiled?
>> >
>> > Why? I want to include Word 2003 Compatibility Options in a Word 2002
>> > Tool. [Application.Version] will determine what code is run. Ideally
>> >
>> > if Application.Version = 11 then
>> > Compatilitity = 2002
>> > ElseIf Application.Version = 12
>> > Compatilitity = 2003
>> > etc.
>> >
>> > Any assistance will be greatly appreciated.
>> >
>> > Regards
>> > Mike
>>
>> If I remember correctly, Word only compile the current modules, so you
>> can
>> use that to your advantage.
>> What you can do is have a central module that will determine the current
>> version, something like the code you posted.
>>
>> Then, once the current version has been determined, this central module
>> will
>> call a sub in one of two modules - one for each version of Word that you
>> want to use. This way, Word will compile only the called modules - the
>> central/starting one and the one called from there. The initial version
>> detecting code could be in the Document_Open and/or Document_New subs of
>> the
>> ThisDocument module.
>>
>> It is not ideal as you may have to write some code twice.... What you
>> could
>> do is have a fourth module that would hold the code that is not dependent
>> on
>> the current Word version and have the other version-dependant module call
>> its subs as needed.
>>
>>
>> --
>>
>> Salut!
>> _______________________________________
>> Jean-Guy Marcil - Word MVP
>> jmarcilREMOVE@CAPSsympatico.caTHISTOO
>> Word MVP site:
http://www.word.mvps.org
>>
>>
>>