Word version independent macros

S

sweet_dreams

Hi,

I have created word template with some subs and functions. Generally
this macros, copy content of other .doc dokument and paste it to active
document, create tables and format text. I created this template in
wrod 2003. But it turned out that this template will be used on
computers where are Word versions form 97 to 2003 and in the future
perhaps 2007.
So my question is what can I do to make this template (especialy macros
in this template) Word version independent? Can I use objects like
ActiveDocument, Selection??? Or Should I rewrite this macros using late
binding???

Any help, suggestions will be appreciated.

Regards,
sweet_dreams
 
J

Jezebel

Test your macros on the Word 97 machine. If they will run there, they will
run on all the later versions. ActiveDocument and Selection objects have
been around since W97; but obviously there are all the Word features that
have been added since, that you can't use if the code has to run on W97.
There are also some VBA functions that have been added since 97 (Split and
Join come to mind) not sure what else.

You can do version-specific work using constructions like --

Dim pWordApp as object
Set pWordApp = Application
if pWordApp.Version > 10 then
pWordApp.[method added after Word 10]
else
msgbox "Can't do that with this version of Word"
end if

But your application will quickly become unmanagable if you do much of this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top