Я попытался выяснить, как обрабатывать несколько объектов сообщений программно с помощью следующего фрагмента, но у меня возникли проблемы с ним.В конечном итоге я хочу отправить сообщение списку получателей в файле электронной таблицы.Какие объекты и методы будут выполнять работу самым простым способом?
Dim w As Outlook.Application
Dim wInbox As Outlook.MAPIFolder
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim count, x, msgnum As Integer
' Handle Microsoft outlook
Set w = GetObject(, "Outlook.Application")
If Err = ERR_APP_NOTRUNNING Then ' Open new instance if none is running
Set w = New Outlook.Application
wInbox = w.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
End If
'Count number of emails required
count = Cells(1, 2).End(xlDown).Row
msgnum = wInbox.Items.count
For x = 1 To count
Set objOutlookMsg = w.CreateItem(olMailItem)
msgnum = wInbox.Items.count
Next x
------- Редактировать --------- Что если я обработаю код, подобный этому?*
Dim w As Outlook.Application
Dim wInbox As Outlook.MAPIFolder
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim count, x, msgnum As Integer
' Handle Microsoft outlook
Set w = GetObject(, "Outlook.Application")
If Err = ERR_APP_NOTRUNNING Then ' Open new instance if none is running
Set w = New Outlook.Application
End If
wInbox = w.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
'Count number of emails required
count = Cells(1, 2).End(xlDown).Row
msgnum = wInbox.Items.count
For x = 1 To count
Set objOutlookMsg = w.CreateItem(olMailItem)
msgnum = wInbox.Items.count
Next x