Attribute VB_Name = "modRTF" Option Explicit Public Type Rect Left As Long Top As Long Right As Long Bottom As Long End Type 'Public Type CharRange ' cpMin As Long ' First character of range (0 for start of doc) ' cpMax As Long ' Last character of range (-1 for end of doc) 'End Type Public Type CharRange firstChar As Long ' First character of range (0 for start of doc) lastChar As Long ' Last character of range (-1 for end of doc) End Type Public Type FormatRange hdc As Long ' Actual DC to draw on hdcTarget As Long ' Target DC for determining text formatting rectRegion As Rect ' Region of the DC to draw to (in twips) rectPage As Rect ' Page size of the entire DC (in twips) mCharRange As CharRange ' Range of text to draw (see above user type) End Type 'Public Type FormatRange ' hdc As Long ' Actual DC to draw on ' hdcTarget As Long ' Target DC for determining text formatting ' rc As Rect ' Region of the DC to draw to (in twips) ' rcPage As Rect ' Region of the entire DC (page size) (in twips) ' chrg As CharRange ' Range of text to draw (see above declaration) 'End Type Public Const WM_USER As Long = &H400 Public Const EM_FORMATRANGE As Long = WM_USER + 57 Public Const EM_SETTARGETDEVICE As Long = WM_USER + 72 Public Const PHYSICALOFFSETX As Long = 112 Public Const PHYSICALOFFSETY As Long = 113 Public Declare Function GetDeviceCaps Lib "gdi32" ( _ ByVal hdc As Long, ByVal nIndex As Long) As Long Public Declare Function SendMessage Lib "user32" _ Alias "SendMessageA" _ (ByVal hwnd As Long, ByVal msg As Long, ByVal wp As Long, _ lp As Any) As Long Public Declare Function CreateDC Lib "gdi32" Alias "CreateDCA" _ (ByVal lpDriverName As String, ByVal lpDeviceName As String, _ ByVal lpOutput As Long, ByVal lpInitData As Long) As Long