A
avkokin
Hello.
I have a problem with a table again.
There is a table which has 8 columns (the number of rows maybe is
different).
the table contains next values (for example):
the cell of first column has type of date - 21/07/2008
the cell of second column has type of date - 30/07/2008
the cell of third column has type of data - 15
the cell of fourth column has type of data - 16
the cell of fifth column has type of data - 12000
the cells of sixth and seventh columns has type of data - ÈÈÈÈ.ÈÈ
the cell of eighth column hasn't data
I need extract of data from all columns of the table to the line to
the following type:
"from 21.07.2008 to 30.07.2008 - 12000 x 16% x 15 days x ÈÈÈÈ.ÈÈ"
I started to write the code (below) but I was lose one's train of
thought.
Help me. Maybe I should use a data array?
Sub colToLine()
Dim oTable As Table
Dim nRow As Long
Dim nCol As Long
Dim sStr As String
Dim sStr1 As String
Dim sStr2 As String
Dim oRange As Range
sStr1 = "from "
sStr2 = " to "
Set oTable = ActiveDocument.Tables(1)
Set oRange = Selection.Range
oRange.EndOf wdStory, wdMove
oRange.Collapse wdCollapseEnd
oRange.Select
For nRow = 1 To oTable.Rows.Count
For nCol = 1 To oTable.Columns.Count
sStr = oTable.Cell(nRow, nCol).Range.Text
sStr = Left(sStr, Len(sStr) - 2)
' oRange.InsertAfter sStr1 & sStr2 & " - " & ?????
Next nRow
End With
oTable.Delete
End Sub
Thank you very much.
I have a problem with a table again.
There is a table which has 8 columns (the number of rows maybe is
different).
the table contains next values (for example):
the cell of first column has type of date - 21/07/2008
the cell of second column has type of date - 30/07/2008
the cell of third column has type of data - 15
the cell of fourth column has type of data - 16
the cell of fifth column has type of data - 12000
the cells of sixth and seventh columns has type of data - ÈÈÈÈ.ÈÈ
the cell of eighth column hasn't data
I need extract of data from all columns of the table to the line to
the following type:
"from 21.07.2008 to 30.07.2008 - 12000 x 16% x 15 days x ÈÈÈÈ.ÈÈ"
I started to write the code (below) but I was lose one's train of
thought.
Help me. Maybe I should use a data array?
Sub colToLine()
Dim oTable As Table
Dim nRow As Long
Dim nCol As Long
Dim sStr As String
Dim sStr1 As String
Dim sStr2 As String
Dim oRange As Range
sStr1 = "from "
sStr2 = " to "
Set oTable = ActiveDocument.Tables(1)
Set oRange = Selection.Range
oRange.EndOf wdStory, wdMove
oRange.Collapse wdCollapseEnd
oRange.Select
For nRow = 1 To oTable.Rows.Count
For nCol = 1 To oTable.Columns.Count
sStr = oTable.Cell(nRow, nCol).Range.Text
sStr = Left(sStr, Len(sStr) - 2)
' oRange.InsertAfter sStr1 & sStr2 & " - " & ?????
Next nRow
End With
oTable.Delete
End Sub
Thank you very much.