Jelmer
01-09-2004, 01:33 AM
How can i insert a row in (the middel of) a tabel ?
This is my code:
Public Sub tabelaanpas()
Dim transport As Integer
rijindex = 0
nummer = ActiveDocument.Tables(3).Rows.Count
pagina = 1
hoogte = 0
transport = 0
rijindex = 1
While (rijindex < nummer)
hoogte = hoogte + Int(PointsToCentimeters(ActiveDocument.Tables(3).Rows(rijindex).Height ))
transport = transport + ActiveDocument.Tables(3).Cell(rijnummer, 4).Range.Text
If (pagina = 1) Then
If (hoogte > 11) Then
'ActiveDocument.Tables(3).Rows.Add
ActiveDocument.Tables(3).Cell((rijindex + 1), 2).Range.Text = "Transportbedrag"
ActiveDocument.Tables(3).Cell((rijindex + 1), 3).Range.Text = hoogte
ActiveDocument.Tables(3).Cell((rijindex + 1), 4).Range.Text = hoogte
pagina = pagina + 1
hoogte = 0
End If
End If
If (pagina > 1) Then
If (hoogte > 17) Then
'ActiveDocument.Tables(3).Rows.Add
ActiveDocument.Tables(3).Cell((rijindex + 1), 2).Range.Text = "Transportbedrag"
ActiveDocument.Tables(3).Cell((rijindex + 1), 3).Range.Text = hoogte
ActiveDocument.Tables(3).Cell((rijindex + 1), 4).Range.Text = hoogte
pagina = pagina + 1
hoogte = 0
End If
End If
rijindex = rijindex + 1
Wend
'Positie verticaal van de laatste rij op de pagina krijgen
rijindex = ActiveDocument.Tables(3).Rows.Count
ActiveDocument.Tables(3).Cell(rijindex, 4).Select
Positie = Selection.Information(wdVerticalPositionRelativeToPage)
Onderkant = CentimetersToPoints(21.4)
verschil = Onderkant - Positie
If verschil > 0 Then
ActiveDocument.Tables(3).Rows(rijindex).Height = verschil
ActiveDocument.Tables(3).Rows(rijindex).HeightRule = wdRowHeightExactly
End If
End Sub
I like to use something like this:
ActiveDocument.Tables(3).Rows.Add
But on a specific place.. above rijindex...
So i thought : ActiveDocument.Tables(3).Rows.Add(rijindex)
But that results in a error.. What is it i'm doing wrong..
Or how can i solve this problem
Thnx...
This is my code:
Public Sub tabelaanpas()
Dim transport As Integer
rijindex = 0
nummer = ActiveDocument.Tables(3).Rows.Count
pagina = 1
hoogte = 0
transport = 0
rijindex = 1
While (rijindex < nummer)
hoogte = hoogte + Int(PointsToCentimeters(ActiveDocument.Tables(3).Rows(rijindex).Height ))
transport = transport + ActiveDocument.Tables(3).Cell(rijnummer, 4).Range.Text
If (pagina = 1) Then
If (hoogte > 11) Then
'ActiveDocument.Tables(3).Rows.Add
ActiveDocument.Tables(3).Cell((rijindex + 1), 2).Range.Text = "Transportbedrag"
ActiveDocument.Tables(3).Cell((rijindex + 1), 3).Range.Text = hoogte
ActiveDocument.Tables(3).Cell((rijindex + 1), 4).Range.Text = hoogte
pagina = pagina + 1
hoogte = 0
End If
End If
If (pagina > 1) Then
If (hoogte > 17) Then
'ActiveDocument.Tables(3).Rows.Add
ActiveDocument.Tables(3).Cell((rijindex + 1), 2).Range.Text = "Transportbedrag"
ActiveDocument.Tables(3).Cell((rijindex + 1), 3).Range.Text = hoogte
ActiveDocument.Tables(3).Cell((rijindex + 1), 4).Range.Text = hoogte
pagina = pagina + 1
hoogte = 0
End If
End If
rijindex = rijindex + 1
Wend
'Positie verticaal van de laatste rij op de pagina krijgen
rijindex = ActiveDocument.Tables(3).Rows.Count
ActiveDocument.Tables(3).Cell(rijindex, 4).Select
Positie = Selection.Information(wdVerticalPositionRelativeToPage)
Onderkant = CentimetersToPoints(21.4)
verschil = Onderkant - Positie
If verschil > 0 Then
ActiveDocument.Tables(3).Rows(rijindex).Height = verschil
ActiveDocument.Tables(3).Rows(rijindex).HeightRule = wdRowHeightExactly
End If
End Sub
I like to use something like this:
ActiveDocument.Tables(3).Rows.Add
But on a specific place.. above rijindex...
So i thought : ActiveDocument.Tables(3).Rows.Add(rijindex)
But that results in a error.. What is it i'm doing wrong..
Or how can i solve this problem
Thnx...