Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.tables
Zippy07
 
Posts: n/a
Default Create a macro to insert a customized table

Hello:

I'm trying to create a macro to insert a customized table in a document. I
know next to nothing about VB, but do have some programming background. I
want to create this table so that others in my group can quickly insert it to
have the same style formats and shading applied to tables throughout the
document.

I've read some VB articles, and found the following code to insert a table.
Unfortunatley, it's using an AutoFormat table and I'm clueless about how to
customize the code to suit my needs.

Sub Test()
Selection.Collapse Direction:=wdCollaspeStart
Set myTable = ActiveDocument.Tables.Add(Range:=Selection.Range, NumRows:=5,
NumColumns:=5)
myTable.AutoFormat Format:=wdTableFormatClassic2

End Sub


I would appreciate any help, link, reference, etc.

Thanks

  #2   Report Post  
Posted to microsoft.public.word.tables
Charles Kenyon
 
Posts: n/a
Default Create a macro to insert a customized table

Unless you are changing your customizations dynamically, why not just create
the table and save it as an AutoText entry. If need be, you can use a macro
to retrieve the AutoText.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!

My criminal defense site: http://addbalance.com
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.


"Zippy07" wrote in message
...
Hello:

I'm trying to create a macro to insert a customized table in a document. I
know next to nothing about VB, but do have some programming background. I
want to create this table so that others in my group can quickly insert it
to
have the same style formats and shading applied to tables throughout the
document.

I've read some VB articles, and found the following code to insert a
table.
Unfortunatley, it's using an AutoFormat table and I'm clueless about how
to
customize the code to suit my needs.

Sub Test()
Selection.Collapse Direction:=wdCollaspeStart
Set myTable = ActiveDocument.Tables.Add(Range:=Selection.Range,
NumRows:=5,
NumColumns:=5)
myTable.AutoFormat Format:=wdTableFormatClassic2

End Sub


I would appreciate any help, link, reference, etc.

Thanks



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Table Format Style vs. Table Text Style WebColin Page Layout 11 December 1st 05 11:29 PM
Macro to insert AutoText table loses text formatting Lighthouseman Tables 4 November 18th 05 06:39 PM
Help with macro to add ":" after Table # donna Microsoft Word Help 6 November 17th 05 07:01 PM
Trying to create word macro to insert into SQL Server Ian Clark New Users 1 March 15th 05 05:01 PM
Word 2003 Table AutoFormat vs Macro vs VBA Kind writer/user/programmer Tables 1 October 28th 04 03:14 PM


All times are GMT +1. The time now is 10:55 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"