Jeg bruger følgende kode til at udskrive en textbox med. Hvordan får jeg den 80 ind på siden og 70 ned?
Jeg har haft en del problemer med, at den kun vil rykke den øverste linje ind
(
Option Explicit
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" ( _
ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any) As Long
Private Const EM_GETLINE = &HC4
Private Const EM_GETLINECOUNT = &HBA
Private Const EM_LINELENGTH = &HC1
Private Sub Command1_Click()
PrintMultiLineTextBox txttitle
End Sub
Private Sub PrintMultiLineTextBox(ByRef txtBox As TextBox)
Dim intLastLine As Integer
Dim intLength As Integer
Dim strTemp As String
Dim intIndex As Integer
Dim strPrint As String
intLastLine = SendMessage(txtBox.hwnd, EM_GETLINECOUNT, 0, 0) - 1
If intLastLine > 0 Then
For intIndex = 0 To intLastLine Step 1
intLength = SendMessage(txtBox.hwnd, EM_LINELENGTH, intIndex + 1, 0)
strTemp = Space$(intLength)
SendMessage txtBox.hwnd, EM_GETLINE, intIndex, ByVal strTemp
strPrint = strPrint & strTemp & vbCrLf
Next intIndex
strPrint = Left$(strPrint, Len(strPrint) - 2)
Else
strPrint = txtBox.Text
End If
Printer.Print strPrint
Printer.EndDoc
End Sub