Цитата: когда я ввожу текст с пробелом между рядами. Если пробел в самом ряду , то все печатает коректно....
беда не в прбелах а в переносах в конце строки
nLen = 0 выходит ошибка
вылечилось дополнительной проверкой
Код: Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal msg As Long, ByVal wp As Long, lp As Any) As Long
Const EM_LINEINDEX = &HBB
Const EM_LINELENGTH = &HC1
Const EM_GETLINE = &HC4
Const EM_GETLINECOUNT = &HBA
Public Function GetLine(hWnd As Long, Line As Long) As String
Dim sBuf As String, nLen As Long, nIndex As Long
nIndex = SendMessage(hWnd, EM_LINEINDEX, Line - 1, ByVal 0&)
If nIndex < 0 Or Line <= 0 Then Exit Function
nLen = SendMessage(hWnd, EM_LINELENGTH, nIndex, ByVal 0&)
If nLen = 0 Then GetLine = "": Exit Function
sBuf = Space(nLen + 1)
Mid$(sBuf, 1, 1) = Chr$(nLen And &HFF)
Mid$(sBuf, 2, 1) = Chr$(nLen \ 256)
SendMessage hWnd, EM_GETLINE, Line - 1, ByVal sBuf
GetLine = Left$(sBuf, nLen)
End Function
Private Sub Command1_Click()
Z1 = 300
Z2 = 300
Printer.ScaleMode = 1
Printer.FontSize = 14
For N = 1 To SendMessage(Text1.hWnd, EM_GETLINECOUNT, 0, 0)
For X = 1 To Len(GetLine(Text1.hWnd, CInt(N)))
Printer.CurrentX = 1000 + X * Z1
Printer.CurrentY = 1000 + N * Z2
Printer.Print Mid(GetLine(Text1.hWnd, CInt(N)), X, 1)
Next X
Next N
Printer.EndDoc
End Sub