powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Microsoft Office [игнор отключен] [закрыт для гостей] / Lotus Notes. Attachements
4 сообщений из 4, страница 1 из 1
Lotus Notes. Attachements
    #37186253
skleppi
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Всем добрый день!

Пытаюсь освоить работу с Lotus Notes через VBA. На просторах инета нашла очень полезный код, который сохраняет все attachments из почтового ящика на диск.

Но мне не нужно сохранять все. Как я могу задать условие на тему письма или на дату отправки??
Заранее спасибо!

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
Option Explicit
 
Const stPath As String = "c:\Attachments\"

Const EMBED_ATTACHMENT As Long =  1454 

Const RICHTEXT As Long =  1 
 
Sub Save_Remove_Attachments()
  Dim noSession As Object
  Dim noDatabase As Object
  Dim noView As Object
  Dim noDocument As Object
  Dim noNextDocument As Object
 
  'Embedded objects are of the datatype Variant.
  Dim vaItem As Variant
  Dim vaAttachment As Variant
 
  'Instantiate the Notes session.
  Set noSession = CreateObject("Notes.NotesSession")
 
   'Instantiate the actual Notes database.
  '(Here is the personal e-mail database used and since it's a
  'local database no reference is made to any server.)
  Set noDatabase = noSession.GETDATABASE("", "mail\xldennis.nsf")
 
  'Folders are views in Lotus Notes and in this example the Inbox is used.
  Set noView = noDatabase.GetView("($Inbox)")
 
  'Get the first document in the defined view.
  Set noDocument = noView.GetFirstDocument
 
  'Iterate through all the e-mails in the view Inbox.
  Do Until noDocument Is Nothing

    'Although the following approach is not necessary for this
    'kind of operations it may be a good approach to use in general.
    Set noNextDocument = noView.GetNextDocument(noDocument)
   
    'Check if the document has an attachment or not.
    If noDocument.HasEmbedded Then
      Set vaItem = noDocument.GetFirstItem("Body")
      If vaItem.Type = RICHTEXT Then
        For Each vaAttachment In vaItem.EmbeddedObjects
          If vaAttachment.Type = EMBED_ATTACHMENT Then
            'Save the attached file into the new folder and remove it from the e-mail.
            With vaAttachment
              .ExtractFile stPath & vaAttachment.Name
              .Remove
            End With
            'Save the e-mail in order to reflect the deleting of the attached file.
            '(A more sophisticated approach may be considered if several e-mails have
             'several attachments in order to avoid a repeately saving of one e-mail.)
            noDocument.Save True, False
          End If
        Next vaAttachment
      End If
    End If
    Set noDocument = noNextDocument
  Loop
 
  'Release objects from memory.
  Set noNextDocument = Nothing
  Set noDocument = Nothing
  Set noView = Nothing
  Set noDatabase = Nothing
  Set noSession = Nothing
 
  MsgBox "All the attachments in the Inbox have successfully been saved and removed." _
  , vbInformation
 
End Sub

Источник: http://www.rondebruin.nl/notes1.htm
...
Рейтинг: 0 / 0
Lotus Notes. Attachements
    #37186331
Ципихович Эндрю
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
skleppi, вот интересно, что у Вас прям такая: "c:\Attachments\" папка есть?
...
Рейтинг: 0 / 0
Lotus Notes. Attachements
    #37187802
skleppi
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Ципихович Эндрю,

какая разница, вопрос не в этом
...
Рейтинг: 0 / 0
Lotus Notes. Attachements
    #37187869
Фотография The_Prist
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
skleppi,

Наверное, ковырять надо в этом направлении:
vaItem.text или vaItem.body

Лучше поковырять справку по этому самому Lotus Notes и подсмотреть какое свойство отвечает за определение Темы или Даты.
...
Рейтинг: 0 / 0
4 сообщений из 4, страница 1 из 1
Форумы / Microsoft Office [игнор отключен] [закрыт для гостей] / Lotus Notes. Attachements
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]