Using "Table.Style" in pre-2003 Word

  • Thread starter Michael Kellogg
  • Start date
M

Michael Kellogg

I have a module that formats a table using the "Table.Style" property. It
runs in 2003 and I think it runs find in 2002, as well. However, I have
one or two users who have Word 2000 and it throws a compiler error for
them, it says it does not recognize that "style" member.

Can I either use some sort of pre-compiler "#IF" type statement in
conjunction with the Word 2000 counterpart to "Table.Style" (assuming there
is one), or do this in another way? I'd rather not remove that line
altogether in order to get everyone working.

Thanks in advance for any suggestions.
 
C

Cindy M -WordMVP-

Hi Michael,
I have a module that formats a table using the "Table.Style" property. It
runs in 2003 and I think it runs find in 2002, as well. However, I have
one or two users who have Word 2000 and it throws a compiler error for
them, it says it does not recognize that "style" member.

Can I either use some sort of pre-compiler "#IF" type statement in
conjunction with the Word 2000 counterpart to "Table.Style" (assuming there
is one), or do this in another way? I'd rather not remove that line
altogether in order to get everyone working.
Unfortunately no, there's no way to precompile. What can work is to place all
non-Word 2000 code in a separate module. Under ideal circumstances, Word only
compiles a module when it's actively called during execution. So placing
"problem" code in a separate module, then doing a version check and branching
should work.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
M

Michael Bednarek

I have a module that formats a table using the "Table.Style" property. It
runs in 2003 and I think it runs find in 2002, as well. However, I have
one or two users who have Word 2000 and it throws a compiler error for
them, it says it does not recognize that "style" member.

Can I either use some sort of pre-compiler "#IF" type statement in
conjunction with the Word 2000 counterpart to "Table.Style" (assuming there
is one), or do this in another way? I'd rather not remove that line
altogether in order to get everyone working.

Thanks in advance for any suggestions.

If you need to write VBA code which is backwards compatible, you have to
use the smallest common denominator. In this case, tblTable.AutoFormat()
might do the trick. Alternatively, you can address each design element
of a table and set it explicitly.

There's a lucid article on table formatting in VBA specifically for
Word 9 (aka 2000) at
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnovba00/html/TableStyles.asp>.

You might also want to read this thread:
<http://groups-beta.google.com/group...read/thread/6d088291863234a9/1aefcee19a379e99>
or
<http://groups.google.fi/groups?hl=en&[email protected]>
(The second link is to one of the few Google Group sites which have so
far escaped the "new improved" (ha!) beta treatment.)
 

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