Afternoon!
I have recently had the exact same problem. It is not an easy thing to word wrap the text, put the code at the bottom of this post into a class. I only put it together quickly so it might not be very pretty code!
You will notice an escape sequence that is the start of each line (the text box I have used is not visible). This escape sequence contains details to make the print out look nice (ie Bold, Underlined, Fontsize) you can get rid of this bit if it's not required.
Let me know if this is useful.
Cheers,
Mark
###########
Option Explicit
'Default margin values
Private Const MARGIN_LEFT = 720
Private Const MARGIN_RIGHT = 720
Private Const MARGIN_TOP = 1440
Private Const MARGIN_BOTTOM = 1440
'Modifiable parameters
Private m_HeaderText As String
Private m_MarginLeft As Single
Private m_MarginTop As Single
Private m_MarginRight As Single
Private m_MarginBottom As Single
Public Property Let HeaderText(sText As String)
m_HeaderText = sText
End Property
Public Property Get HeaderText() As String
HeaderText = m_HeaderText
End Property
Public Property Let MarginLeft(nMargin As Single)
m_MarginLeft = nMargin
End Property
Public Property Get MarginLeft() As Single
MarginLeft = m_MarginLeft
End Property
Public Property Let MarginTop(nMargin As Single)
m_MarginTop = nMargin
End Property
Public Property Get MarginTop() As Single
MarginTop = m_MarginTop
End Property
Public Property Let MarginRight(nMargin As Single)
m_MarginRight = nMargin
End Property
Public Property Get MarginRight() As Single
MarginRight = m_MarginRight
End Property
Public Property Let MarginBottom(nMargin As Single)
m_MarginBottom = nMargin
End Property
Public Property Get MarginBottom() As Single
MarginBottom = m_MarginBottom
End Property
'Public method to print text
Public Sub PrintText(sText As String)
Dim i As Integer, j As Integer, sCurrWord As String
Screen.MousePointer = vbHourglass
'Initialize first page
DoNewPage False
'Print text, word-wrapping as we go
i = 1
Do Until i > Len(sText)
'Get next word
sCurrWord = ""
Do Until i > Len(sText) Or Mid$(sText, i, 1) <= " "
sCurrWord = sCurrWord & Mid$(sText, i, 1)
i = i + 1
Loop
' If it is our escape sequence then look at the settings
If Left(sCurrWord, 6) = "&~~**#" Then
' Bold?
Select Case Mid(sCurrWord, 7, 1)
Case "Y"
Printer.FontBold = True
Case Else
Printer.FontBold = False
End Select
' Underlined?
Select Case Mid(sCurrWord, 8, 1)
Case "Y"
Printer.FontUnderline = True
Case Else
Printer.FontUnderline = False
End Select
' Font size
Printer.FontSize = Mid(sCurrWord, 9, 2)
' Left margin
Select Case Mid(sCurrWord, 11, 1)
Case "M"
'Printer.CurrentX = Mid(sCurrWord, 12, 4)
m_MarginLeft = Mid(sCurrWord, 12, 4)
Printer.CurrentX = m_MarginLeft
End Select
i = i + 1
Else
'Check if word will fit on this line
If (Printer.CurrentX + Printer.TextWidth(sCurrWord)) > (Printer.ScaleWidth - m_MarginRight) Then
'Send carriage-return line-feed to printer
Printer.Print
'Check if we need to start a new page
If Printer.CurrentY > (Printer.ScaleHeight - m_MarginBottom) Then
DoNewPage
Else
Printer.CurrentX = m_MarginLeft
End If
End If
'Print this word
Printer.Print sCurrWord;
'Process whitespace and any control characters
Do Until i > Len(sText) Or Mid$(sText, i, 1) > " "
Select Case Mid$(sText, i, 1)
Case " " 'Space
Printer.Print " ";
Case Chr$(10) 'Line-feed
'Send carriage-return line-feed to printer
Printer.Print
'Check if we need to start a new page
If Printer.CurrentY > (Printer.ScaleHeight - m_MarginBottom) Then
DoNewPage
Else
Printer.CurrentX = m_MarginLeft
End If
Case Chr$(9) 'Tab
j = (Printer.CurrentX - MARGIN_LEFT) / Printer.TextWidth("0"

j = j + (10 - (j Mod 10))
Printer.CurrentX = MARGIN_LEFT + (j * Printer.TextWidth("0"

)
Case Else 'Ignore other characters
End Select
i = i + 1
Loop
End If
Loop
Printer.EndDoc
Screen.MousePointer = vbDefault
End Sub
'Prints page header and footer
Private Sub DoNewPage(Optional bEjectPage As Boolean = True)
Dim Buff As String
'Start new page if requested
If bEjectPage Then
Printer.NewPage
End If
'Print page header
Printer.FontSize = 14
Printer.FontBold = True
Printer.FontUnderline = True
Printer.CurrentY = (m_MarginTop - Printer.TextHeight(m_HeaderText)) / 2
Printer.CurrentX = ((Printer.ScaleWidth - Printer.TextWidth(m_HeaderText)) / 2) '- 1500
Printer.Print m_HeaderText;
Printer.FontSize = 10
Printer.FontBold = False
Printer.FontUnderline = False
'Print page footer
Buff = Format$(Now, "DD/MM/YYYY HH:MM:SS"

Printer.CurrentX = m_MarginLeft
Printer.CurrentY = Printer.ScaleHeight - (m_MarginBottom / 2)
Printer.Print Buff;
Buff = "Page " & CStr(Printer.Page)
Printer.CurrentX = Printer.ScaleWidth - (Printer.TextWidth(Buff) + m_MarginRight)
Printer.CurrentY = Printer.ScaleHeight - (m_MarginBottom / 2)
Printer.Print Buff;
'Reset position to top of page
Printer.CurrentX = m_MarginLeft
Printer.CurrentY = m_MarginTop
End Sub
Private Sub Class_Initialize()
'Set default properties
m_MarginLeft = MARGIN_LEFT
m_MarginRight = MARGIN_RIGHT
m_MarginTop = MARGIN_TOP
m_MarginBottom = MARGIN_BOTTOM
m_HeaderText = "Title of page"
End Sub