Avatar of JuliaReynolds
JuliaReynolds
 asked on

Adding Tables to Word

I am trying to get tables to add into a word document and do not know how to do it, I have pasted the information below and attached the word document so that you can see the actual tables.  

I  need to create two macros and/or non- printing command buttons, one to add  new topic title tables

(This is the Topic Title Table)  each time a new topic title is added it would need to appear on the next blank page.  A page break would need to be written in the command
2.      Click here to enter Topic Title

and one that would add the section title table (this table’s numbering convention would need to follow that of the topic title section above it (ie when topic title table:2 is added all section tables inserted beneath it would follow the 2.1, 2.2, 2.3 etc  numbering and when topic title table 3 is added the sections tables beneath it would follow the 3.1, 3.2, 3.3 etc. numbering convention. (there is a potential for several section title tables to be under each topic title table).

2.1      "[Click here to enter Section Title]"

      
      "[Click here to enter Section Text]"

      
(this is the Section Title Table)

When a new Topic title table is added it needs to start on the next available page number.  A simple page break in the code should work


On my template I am going to have the topic title and one section on it.

2.      Click here to enter Topic Title
2.1      "[Click here to enter Section Title]"

      
      "[Click here to enter Section Text]"

      



Below is what an example of what I am trying to accomplish, this is the topic title table added and 5 section title tables added followed by another topic title table with three title tables added.

2.      Click here to enter Topic Title
2.1      "[Click here to enter Section Title]"

      
      "[Click here to enter Section Text]"

      
2.2      "[Click here to enter Section Title]"

      
      "[Click here to enter Section Text]"

      
2.3      "[Click here to enter Section Title]"

      
      "[Click here to enter Section Text]"

      
2.4      "[Click here to enter Section Title]"

      
      "[Click here to enter Section Text]"

      
2.5      "[Click here to enter Section Title]"

      
      "[Click here to enter Section Text]"

      



3      Click here to enter Topic Title
3.1      "[Click here to enter Section Title]"

      
      "[Click here to enter Section Text]"

      
3.2      "[Click here to enter Section Title]"

      
      "[Click here to enter Section Text]"

      
3.3      "[Click here to enter Section Title]"

      



I was also hoping to get the topic titles, section number and associated page numbers to auto insert to a table of contents on the first page of the document, is that possible?

Topic      Page
2.      Click here to enter topic title.
Pg Number.

3.      Click here to enter topic title
Pg Number.

4.      Click here to enter topic title
Pg Number



The table on the front would have to add a row if additional Topic Title sections were added.
Inserting-Tables-into-Word-Help-Needed.d
Microsoft WordVisual Basic ClassicVBA

Avatar of undefined
Last Comment
Martin Liss

8/22/2022 - Mon
MicrosoftSavvy

What version of office are you using
JuliaReynolds

ASKER
2010
ASKER CERTIFIED SOLUTION
GrahamSkan

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
JuliaReynolds

ASKER
How would you get the table to add once you have written the code
Your help has saved me hundreds of hours of internet surfing.
fblack61
DrTribos

Julia, you would need to add the code then run the code. As per Graham's comment the scope of this question is a little broad... Graham has given you 2 approaches for adding tables, you can call the sub by typing NewTable in the VBA IDE Immediate window.
Martin Liss

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.