\'----Set disse på en Form---- \'Text1.MultiLine = True \'Text2 \'Label1 \'----------------------------
\'------------------------------ Form1 ------------------------------ Private Declare Function SendMessageLong Lib \"USER32\" Alias \"SendMessageA\" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long Private Declare Function SendMessageByRef Lib \"USER32\" Alias \"SendMessageA\" (ByVal hWnd As Long, ByVal wMsg As Long, wParam As Long, lParam As Any) As Long Private Declare Function SendMessageByLong Lib \"USER32\" Alias \"SendMessageA\" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
sjh > jeg forstår ikke hvor du vil hen med din kode, men kan du svare på mit nye spørgsmål der ligner det her spørgsmål meget, giver jeg dig, pointene for den her og den nye :) http://www.eksperten.dk/spm/123353
\'---------------------- Form1 ------------------------ Dim arrLine \'øverst i form1
Private Sub Command1_Click() \'Test Command1 Dim i As Integer For i = 1 To UBound(arrLine) List1.AddItem arrLine(i) \'Test List1 Next i End Sub
Private Sub Command2_Click() \'Test Command2 Text1.Text = arrLine(2) End Sub
Private Sub Form_Load() \'Text1.MultiLine = True Text1.Text = \"Linje 1\" & vbNewLine & \"Linje 2\" & vbNewLine & \"Linje 3\" arrLine = LineText(Text1.Text) End Sub \'---------------------- Form1 ------------------------
\'------------------- Form1/Module1 ------------------- Public Function LineText(txt As String) As Variant Dim i, aPos, bPos, cont As Long Dim tRetArray() As Variant Dim RetArray() As Variant ReDim tRetArray(10000) \'max linjer TextLine = Empty If Right(txt, 2) <> Chr(13) & Chr(10) Then txt = txt & Chr(13) aPos = 1 For i = 1 To Len(txt) If Mid(txt, i, 1) = Chr(13) Then bPos = i - 2 cont = cont + 1 tRetArray(cont) = Mid(txt, aPos, (bPos - aPos) + 2) aPos = bPos + 4 End If Next i ReDim RetArray(cont) For i = 1 To cont RetArray(i) = tRetArray(i) Next i LineText = RetArray End Function \'------------------- Form1/Module1 -------------------
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.