Hello,
I'm trying to mash together some code to speed along a process of making certain types of documents. Basically I have a form where I fill out all the information I need, press a generate button, and it's transfered to the word document in a certain format. Type in another set of information, press generate, and another table is placed underneath the first one. And so on...
I have the code:
[VBA]Set tableNew = ThisDocument.Tables.Add(Selection.Range, X, Y)
With tableNew
.Rows(1).Shading.BackgroundPatternColor = wdColorGray125
.Cell(1, 1).Range.InsertAfter "Conveyor Section"
.Cell(1, 2).Range.InsertAfter "Device Type"
.Cell(1, 3).Range.InsertAfter "Device Sub-Type"
.Cell(1, 4).Range.InsertAfter "Functional Description"
.Cell(1, 5).Range.InsertAfter "P/F"
.Cell(1, 6).Range.InsertAfter "Comments"
.Cell(1, 7).Range.InsertAfter "Date"
End With [/VBA]
My question is: How do I create another table below the first one? Do I need to keep track of some kind of index number when I reference the 2nd, 3rd, etc table, or can I reference the cells like the code: put "this" in cell(1,1) for table 2?
Many thanks for any help. I'm a PLC programmer, so feel free to roll your eyes at my (hopefully) silly questions