Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim rtitem As NotesRichTextItem
Dim object As NotesEmbeddedObject
Dim doc As NotesDocument
Dim filename As Variant
Dim session As New NotesSession
Dim c As Variant
Dim docprofile As NotesDocument
Set db = session.CurrentDatabase
Set docprofile = db.GetProfileDocument("path", session.UserName)
If docprofile.IsNewNote Then
c(0) = "Y:\Scan\Archive\"
Else
c = docprofile.GetItemValue("path")
End If
filename = ws.OpenFileDialog( True, "Выберите файл(ы)",, Cstr(c(0)))
Set uidoc = ws.CurrentDocument
Call uidoc.GotoField("Scan")
Forall i In filename
Call uidoc.Import("JPEG Image", i)
End Forall
Set doc = uidoc.Document
Set rtitem = New NotesRichTextItem( doc, "Atach" )
Forall j In filename
Set object = rtitem.EmbedObject( EMBED_ATTACHMENT, "", j, Бекап)
End Forall
If docprofile.isnewnote Then
Set rtitem = docprofile.CreateRichTextItem( "path" )
Call docprofile.ReplaceItemValue("path", Strleftback(Cstr(filename(0)), Right(Cstr(filename(0)),26)))
Call docprofile.Save(True,False)
Else
Call docprofile.ReplaceItemValue("path", Strleftback(Cstr(filename(0)), Right(Cstr(filename(0)),26)))
Call docprofile.Save(True,False)
End If