hi, I was looking for this for sometime, and finally found it.

Though I now search in the forum, then I do find it posted in one two threads. I posted it here in this Code-Bank section, because I think this one is really handy.
Usage:
SetAlignment RichTextBox1.HWND, ercParaJustify
VB Code:
  1. Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal HWND As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
  2. 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
  3. Const WM_USER = &H400
  4. Const EM_SETTYPOGRAPHYOPTIONS = WM_USER + 202
  5. Const TO_ADVANCEDTYPOGRAPHY = 1
  6. Const EM_SETPARAFORMAT = WM_USER + 71
  7. Private Const PFA_LEFT = 1
  8. Private Const PFA_RIGHT = 2
  9. Private Const PFA_CENTER = 3
  10. Private Const PFA_JUSTIFY = &H4
  11. Const MAX_TAB_STOPS = 32
  12. Private Type PARAFORMAT2
  13.     cbSize                     As Long
  14.     dwMask                     As Long
  15.     wNumbering                 As Integer
  16.     wEffects                   As Integer
  17.     dxStartIndent              As Long
  18.     dxRightIndent              As Long
  19.     dxOffset                   As Long
  20.     wAlignment                 As Integer
  21.     cTabCount                  As Integer
  22.     rgxTabs(MAX_TAB_STOPS - 1) As Long
  23.     dySpaceBefore              As Long
  24.     dySpaceAfter               As Long
  25.     dyLineSpacing              As Long
  26.     sStyle                     As Integer
  27.     bLineSpacingRule           As Byte
  28.     bOutlineLevel              As Byte
  29.     wShadingWeight             As Integer
  30.     wShadingStyle              As Integer
  31.     wNumberingStart            As Integer
  32.     wNumberingStyle            As Integer
  33.     wNumberingTab              As Integer
  34.     wBorderSpace               As Integer
  35.     wBorderWidth               As Integer
  36.     wBorders                   As Integer
  37. End Type
  38. Public Enum ERECParagraphAlignmentConstants
  39.    ercParaLeft = PFA_LEFT
  40.    ercParaCentre = PFA_CENTER
  41.    ercParaRight = PFA_RIGHT
  42.    ercParaJustify = PFA_JUSTIFY
  43. End Enum
  44. Private Const PFM_ALIGNMENT = &H8&
  45.  
  46. Private Function SetAlignment(lHwnd As Long, ByVal eAlign As ERECParagraphAlignmentConstants)
  47.     Dim tP2 As PARAFORMAT2
  48.     Dim lR As Long
  49.     tP2.dwMask = PFM_ALIGNMENT
  50.     tP2.cbSize = Len(tP2)
  51.     tP2.wAlignment = eAlign
  52.     lR = SendMessageLong(lHwnd, EM_SETTYPOGRAPHYOPTIONS, TO_ADVANCEDTYPOGRAPHY, TO_ADVANCEDTYPOGRAPHY)
  53.     lR = SendMessage(lHwnd, EM_SETPARAFORMAT, 0, tP2)
  54. End Function