Back to vb6 and msflexgrid, there is a weakness in pasting text to this control. If the user wanted for example to paste a 2*3 array in msflexgrid he should select 2 rows and 3 columns to paste the data, otherwise only one cell will fill in the msflexgrid (insted of 6 cells). i found if i colud split clipboard and count its rows and columns this problem should solve (select msflexgrid cells based on the array size) . I created the "editpaste"SUB:
Private Sub EditPaste()
Dim ARRAYLINES As Variant ' array with the lines
Dim ARRAYCELLS As Variant ' array with the cells of 1 line to count the cols needed
Dim ARRAYLINESidx As Integer
'§ put clipboard in a textbox named "cliper"
With cliper
.Text = Clipboard.GetText
If .Text = "" Then
Exit Sub
Else
ARRAYLINES = Split(.Text, Chr(13)) 'i also used the Chr(10) vbnewline andvbCRLF to count the lines
End If
End With
'§ put textbox in grid
If ARRAYLINES(0) = "" Then
Exit Sub
Else
ARRAYCELLS = Split(ARRAYLINES(0), vbTab) 'to count the columns
msgbox UBound(ARRAYLINES) & UBound(ARRAYCELLS)
End If
'§ clear array
ReDim ARRAYLINES(0)
ReDim ARRAYCELLS(0)
End Sub
But my problem is that i have two types of text arrays (text matrixs). the array that came from msflixgrid to clipboard and the array that came from excell to clipboard and i can not make differencess between them in that sub. bellow is a screenshot from them into MSword:
The arrows n that picture are the TAb Characters i have no problem in counting them and the results are equal for all text arrays. but the paragraph signs are tricky and i knew in the second array they are "vbnewline" but in first array my code can not find them and suppose like i have only one line. Do you know a better way to get equal result in counting these columns and rows?