I don't know anything about dealing with form fields in word, but here is
the code I use to add a row to a table.
Dim WordTable As Word.Table
WordTable.Rows.Add
Set WordRow = WordTable.Rows(WordTable.Rows.Count)
If WordRow.Cells.Count < 4 Then
WordRow.Cells.Add
WordRow.Cells.Add
WordRow.Cells.Add
WordRow.Cells(1).Width = CentimetersToPoints(2.94)
WordRow.Cells(2).Width = CentimetersToPoints(3.2)
WordRow.Cells(3).Width = CentimetersToPoints(1.7)
WordRow.Cells(4).Width = CentimetersToPoints(1.21)
WordRow.Range.Font.Bold = False
WordRow.Range.Font.Italic = False
WordRow.Range.Font.Size = 8
WordRow.Cells(2).Range.Paragraphs(1).Alignment = wdAlignParagraphRight
WordRow.Cells(4).Range.Paragraphs(1).Alignment = wdAlignParagraphRight
WordRow.Cells(1).Range.Paragraphs(1).LeftIndent = -3
WordRow.Cells(2).Range.Paragraphs(1).LeftIndent = -5
WordRow.Cells(3).Range.Paragraphs(1).LeftIndent = -5
WordRow.Cells(4).Range.Paragraphs(1).LeftIndent = -5
WordRow.Cells(1).Range.Paragraphs(1).RightIndent = -5
WordRow.Cells(2).Range.Paragraphs(1).RightIndent = -5
WordRow.Cells(3).Range.Paragraphs(1).RightIndent = -5
WordRow.Cells(4).Range.Paragraphs(1).RightIndent = -3
Else
WordRow.Borders(wdBorderTop).LineStyle = wdLineStyleNone
WordRow.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
End If
I find the best way to work out what to do in Excel or Word, is to record a
macro, then convert the macro commands to vb commands.
Coral
-----Original Message-----
From: "Mark Roworth" <mark.roworth@b...>
Sent: Tue, 10 Dec 2002 08:13:51 -0000
To: professional vb
Hi group,
I want to use automate Word to create reports. Has anyone any experience of
this. I notice that you can insert form fields into a document and then set
the Bookmark property on them, but how do I alter the content of the field
programmatically? Also, how would I increase the length of a table to add
more rows. Any ideas gratefully received,
Mark Roworth
Dolphin Computing Ltd
01273 262865
mark.roworth@b...
----------------------------------------------------------------------