2011-01-19 3 views
1

템플릿에서로드 된 이메일에 숨은 참조 수신자를 추가해야합니다. 수신자는 특정 카테고리의 모든 연락처이어야합니다. 난 그냥 전에 Set newItem = Nothing까지 newItem.Display 이동 한 일을 결국 무엇Outlook VBA를 사용하여 숨은 참조 수신자 추가

Sub Distribute_Newsletter() 
Set newItem = Application.CreateItemFromTemplate("P:\Subscription Templates\subscription template.oft") 
newItem.Display 

Set oNS = Application.GetNamespace("MAPI") 
Set oContacts = oNS.Folders(1).Folders("Contacts") 
Dim emailAddress As String 

For Each oContactItem In oContacts.Items 
    If oContactItem.Class = olContact Then 
     emailAddress = oContactItem.Email1Address 
     If Not emailAddress = "" Then 'And oContactItem.Categories 
      Set objRecip = newItem.Recipients.Add(emailAddress) 
      objRecip.Type = olBCC 
     End If 
    End If 
Next 

Set oNS = Nothing 
Set oContacts = Nothing 
Set objRecip = Nothing 
Set newItem = Nothing 
End Sub 

답변

0

: 그것은 매우 비효율적이고 응답하지 Outlook을 야기를 제외하고 내가 지금까지 다음이있다. 이것은 가장 효율적인 솔루션은 아니지만 충돌을 일으키지 않고 작업을 완료합니다.

관련 문제