Table Macro

R

Ryan

I'm fairly new to VBA. I'm working on a template that should insert a
pre-designed table from a toolbar. My question is wether I have to design the
table through the macro since it's quite an involved table or wether there is
a way to just select the appropriate table (designed before running the
macro) to be able to be pasted wherever in the document?

Hope this makes sense
Thanks
 
D

Doug Robbins - Word MVP

Create the table as an autotext entry and have your macro insert that.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
F

fumei via OfficeKB.com

Absolutely!

1. Make your table
2. Select it
3. Alt-F3 (or Insert > Autotext > New) and give it a name, say myt - for my
table


Done.

You can delete the current table, if you want. It is only there in order to
create it for the AutoText.

Now whenever you want that table, type: myt and press F3

Voila! Your table.

Create the table as an autotext entry and have your macro insert that.
I'm fairly new to VBA. I'm working on a template that should insert a
pre-designed table from a toolbar. My question is wether I have to design
[quoted text clipped - 6 lines]
Hope this makes sense
Thanks
 
F

fumei via OfficeKB.com

Or, via code:

AttachedTemplate.AutoTextEntries("myt").Insert _
Where:=Selection.Range

with the assumption the AutoText entry is to go at the Selection....which of
course it does not. For example:

AttachedTemplate.AutoTextEntries("myt").Insert _
where:=ActiveDocument.Sections(3) _
.Headers(wdHeaderFooterEvenPages).Range

would insert the AutoText entry (your table) into the range of the Even Page
headers of Section 3
Absolutely!

1. Make your table
2. Select it
3. Alt-F3 (or Insert > Autotext > New) and give it a name, say myt - for my
table

Done.

You can delete the current table, if you want. It is only there in order to
create it for the AutoText.

Now whenever you want that table, type: myt and press F3

Voila! Your table.
Create the table as an autotext entry and have your macro insert that.
[quoted text clipped - 3 lines]
 

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