I could have implemented in last update.. However, if I would implement anytime soon (maybe with something other so it would be worth to upgrade type lib version) then as following:
Code:Public Function GetTextRange(ByVal Min As Long, ByVal Max As Long) As String If Min > Max Then Err.Raise 380 If RichTextBoxHandle <> 0 Then Dim RETR As RETEXTRANGE, Buffer As String, Length As Long RETR.CharRange.Min = Min RETR.CharRange.Max = Max Buffer = String$(RETR.CharRange.Max - RETR.CharRange.Min + 1, vbNullChar) RETR.lpstrText = StrPtr(Buffer) Length = SendMessage(RichTextBoxHandle, EM_GETTEXTRANGE, 0, ByVal VarPtr(RETR)) If Length > 0 Then GetTextRange = Left$(Buffer, Length) End If End FunctionEDIT: some other implemented above function not with Min and Max but rather with Start and Length (similar to SelStart and SelLength), so Min = Start and Max = Start + LengthCode:Private Type RECHARRANGE Min As Long Max As Long End Type Private Type RETEXTRANGE CharRange As RECHARRANGE lpstrText As Long End Type Private Const EM_GETTEXTRANGE as Long = (WM_USER + 75)




Reply With Quote