Function copy_richtext(ws As NotesUIWorkspace, rtitm As NotesRichTextItem, Byval s_comment$, _
objApp As Variant, objDoc As Variant, Byval s_target_dir$) As Boolean
    ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    
    ' копирование через буфер содержимого поля rtitm в заданный документ заданного приложения word (текст предваряется комментарием s_comment)
    ' выгрузка в указанный каталог всех прикреплений и ole из данного rtf-поля
    On Error Goto ErrLab
    Dim uid As NotesUIDocument
    Dim itm As NotesItem, doc As NotesDocument, obj As NotesEmbeddedObject
    Dim s_text$, s_file$
    Dim n_ole%
    Dim arEO As Variant
    Dim FR As Boolean
    Set doc = rtitm.Parent
    Call doc.ReplaceItemValue("Form", "BODYFORM")
    Set uid = ws.EditDocument(False, doc, False, "", True)
    On Error Resume Next
    Call uid.ExpandAllSections()
    On Error Goto ErrLab
    Call uid.SelectAll()
    Call uid.Copy        ' копируем в буфер
    Call uid.Close(True)
    ' добавляем разделитель документов
    With objApp.Application.Selection
        .TypeText("= = = = = = = = = = = = = = = = = = = = = = = = = = ")
        .TypeParagraph
        If s_comment <> "" Then
            .Font.Bold = True
            .Font.Size = 20
            .TypeText(s_comment)
            .Font.Bold = False
            .Font.Size = 12
            .TypeParagraph
        End If
        .TypeText("= = = = = = = = = = = = = = = = = = = = = = = = = = ")
        .TypeParagraph
    End With
    Call objApp.Application.Selection.PasteAndFormat(0)
    s_text = ""
    n_ole = 0
    On Error Resume Next
    arEO = rtitm.EmbeddedObjects
    On Error Goto ErrLab
    If Isarray(arEO) Then
        Forall o In rtitm.EmbeddedObjects
            Set obj = o
            If obj.Name = obj.Source Then
                s_file = obj.Source
            Else
                s_file = obj.Name + "-" + obj.Source
            End If
            If dispatch_object(obj, s_target_dir, s_file) Then
                Call objApp.Application.Selection.TypeParagraph
                Call objDoc.Hyperlinks.Add( objApp.Application.Selection.Range, s_file,"","", "Приложение: " + s_file, "")
            Else
                n_ole = n_ole + 1
            End If
        End Forall
        If n_ole > 0 Then
            s_text = "Имеется " + Cstr(n_ole) + " не выгруженных OLE-объектов"
            With objApp.Application.Selection
                .TypeParagraph
                .TypeParagraph
                .Font.Color = 255
                .Font.Bold = True
                .Font.Size = 18
                .TypeText(s_text)
                .Font.Color = 0
                .Font.Bold = False
                .Font.Size = 12
            End With
        End If
        Erase arEO
    End If
    With objApp.Application.Selection
        .TypeParagraph
        .TypeParagraph
        .TypeParagraph
    End With
    FR = True
EndLab:
    copy_richtext = FR
    Exit Function
ErrLab:
    FR = False
    Goto EndLab
End Function