N
neil
Hi,
I'm trying to insert a couple of tables into Word, and have spent a
couple of days trying to figure this out. Either the tables merge
together, or they are displayed in the wrong order.
I thought that using Range.Collapse wdCollapseEnd would take to the
end of the specified range.
However, whatever I am doing, it is inserting text at the start of the
range.
Any ideas where I am going wrong.
Many Thanks
Rgds
Neil.
Code Below (I stripped out the code that populates the table cells,
because there would be just too much code to look at):
----------------------------------------------------------------------
Set tRange = objDoc.Bookmarks("client_table").Range
tRange.Collapse wdCollapseEnd
With tRange
.Text = clientFirstName(currentClient)
.Font.Bold = True
End With
With tRange
.Collapse wdCollapseEnd
.Text = vbCr & vbCr
.Collapse wdCollapseEnd
End With
Set ClientTable = objDoc.Tables.Add(Range:=tRange, _
NumRows:=5, NumColumns:=2)
//////////////////////////////////////////
/// Insert Table Cells - works OK
//////////////////////////////////////////
ClientTable.AutoFormat Format:=wdTableFormatContemporary
If partnerFirstName(currentClient) <> "" Then
Set tRange = objDoc.Bookmarks("client_table").Range
With tRange
.Text = partnerFirstName(currentClient)
.Font.Bold = True
End With
With tRange
.Collapse wdCollapseEnd
.Text = vbCr & vbCr
.Collapse wdCollapseEnd
End With
Set PartnerTable = objDoc.Tables.Add(Range:=tRange, _
NumRows:=4, NumColumns:=2)
//////////////////////////////////////////
/// Insert Table Cells - works OK
//////////////////////////////////////////
PartnerTable.AutoFormat Format:=wdTableFormatContemporary
With tRange
.Collapse wdCollapseEnd
.Text = vbCr & vbCr
.Collapse wdCollapseEnd
End With
End If
I'm trying to insert a couple of tables into Word, and have spent a
couple of days trying to figure this out. Either the tables merge
together, or they are displayed in the wrong order.
I thought that using Range.Collapse wdCollapseEnd would take to the
end of the specified range.
However, whatever I am doing, it is inserting text at the start of the
range.
Any ideas where I am going wrong.
Many Thanks
Rgds
Neil.
Code Below (I stripped out the code that populates the table cells,
because there would be just too much code to look at):
----------------------------------------------------------------------
Set tRange = objDoc.Bookmarks("client_table").Range
tRange.Collapse wdCollapseEnd
With tRange
.Text = clientFirstName(currentClient)
.Font.Bold = True
End With
With tRange
.Collapse wdCollapseEnd
.Text = vbCr & vbCr
.Collapse wdCollapseEnd
End With
Set ClientTable = objDoc.Tables.Add(Range:=tRange, _
NumRows:=5, NumColumns:=2)
//////////////////////////////////////////
/// Insert Table Cells - works OK
//////////////////////////////////////////
ClientTable.AutoFormat Format:=wdTableFormatContemporary
If partnerFirstName(currentClient) <> "" Then
Set tRange = objDoc.Bookmarks("client_table").Range
With tRange
.Text = partnerFirstName(currentClient)
.Font.Bold = True
End With
With tRange
.Collapse wdCollapseEnd
.Text = vbCr & vbCr
.Collapse wdCollapseEnd
End With
Set PartnerTable = objDoc.Tables.Add(Range:=tRange, _
NumRows:=4, NumColumns:=2)
//////////////////////////////////////////
/// Insert Table Cells - works OK
//////////////////////////////////////////
PartnerTable.AutoFormat Format:=wdTableFormatContemporary
With tRange
.Collapse wdCollapseEnd
.Text = vbCr & vbCr
.Collapse wdCollapseEnd
End With
End If