Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
append row to table?
I have a dot file that contains a table. I need to populate that table via
VBA from MS Access. I've done this sort of things many times but what I need to do here appears to be different than what I'm used to. There is a header row in the table. Then I have 1 detail row below that. I presently have bookmarks in each cell of that row. The problem is that the code I'm writing will need to add sevearl more detail rows the number of which can vary from customer to customer. The first question is how can I "append" a new row in code so that the new row goes to the end instead of "inserting" it above the current row? The second question is what is the best way to get the data into the other rows since I can only have one set of bookmarks for the first row? Should I abandon bookmarks altogether and just use "TAB" in code to get to where I need to be on the form before posting the data to it? Thank you, Keith |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
append row to table?
The statement
myTable.Rows.Add adds one new row at the end of the table (I assume you've assigned the Table object named myTable to point to the correct table in the document). The ..Add method can take an optional parameter containing the index of an existing row, and the new row would be added before that existing row. Omit the parameter completely to put the new row at the end. Each cell of the table is independently addressable without bookmarks. As an example, if you want to put text into the second cell of the last row of the table, you can do something like this: Dim lastRow As Long ... myTable.Rows.Add lastRow = myTable.Rows.Count myTable.Cell(lastRow, 2).Range.Text = "some text" -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. Keith G Hicks wrote: I have a dot file that contains a table. I need to populate that table via VBA from MS Access. I've done this sort of things many times but what I need to do here appears to be different than what I'm used to. There is a header row in the table. Then I have 1 detail row below that. I presently have bookmarks in each cell of that row. The problem is that the code I'm writing will need to add sevearl more detail rows the number of which can vary from customer to customer. The first question is how can I "append" a new row in code so that the new row goes to the end instead of "inserting" it above the current row? The second question is what is the best way to get the data into the other rows since I can only have one set of bookmarks for the first row? Should I abandon bookmarks altogether and just use "TAB" in code to get to where I need to be on the form before posting the data to it? Thank you, Keith |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how do you append one table to another in Word 2003 | Tables | |||
Can you append a document in Word? | Microsoft Word Help | |||
Append two documents to one, how | New Users | |||
Macro to Append Word Documents | Page Layout | |||
how can I append one table onto another | Microsoft Word Help |