Regouin
12-05-2005, 06:47 AM
Hello everyone,
I am struggling to set every recipient in a mail to BCC, i have created a listbox with mailadresses but obviously i dont want all the customers to see each others emailadresses so i am trying to set them all to bcc. Here is the code what i have, and i just cant find the command to set them to BCC.
Sub eMailDocument()
Dim AppOutlook As Outlook.Application
Dim OL As Object
Dim EmailItem As Object
Dim y As Long
Dim TempChar As String
Dim SaveName As String
Dim i As Long
Application.ScreenUpdating = False
Set OL = CreateObject("Outlook.Application")
Set EmailItem = OL.CreateItem(olMailItem)
With EmailItem
.Subject = "U heeft post ontvangen in U HuurEenBox postbox."
.Body = "Beste HuurEenBox klant," & vbCrLf & vbCrLf & "Er is post voor u binnengekomen in uw HuurEenBox postbox. Deze kunt U afhalen bij het HuurEenBox filiaal in Aalsmeer." & vbCrLf & vbCrLf & "Met vriendelijke groet," & vbCrLf & "Het team van HuurEenBox."
For i = 0 To ListBox2.ListCount - 1
.Recipients.Add ListBox2.List(i, 0)
Next i
.Importance = olImportanceNormal 'Or olImportanceHigh Or olImportanceLow
On Error GoTo fout
.Send
End With
Application.ScreenUpdating = True
Set OL = Nothing
Set EmailItem = Nothing
MsgBox ("Rapport verzonden")
GoTo eind
fout:
MsgBox ("Outlook moet toestemming krijgen om de mail te kunnen versturen, verstuur bericht opnieuw.")
eind:
End Sub
please ignore the dutch in the msgboxes and mailbody
TIA
Frank
*edit*
i tried inserting this just after declaring the recipients but that doesnt seem to work
For Each recipient In .Recipients
Set .Type = olBCC
Next recipient
i also try to use a variable and dim that as a recipient but that generates the same error messages, i am quite lost with this atm.
TIA
frank
*edit*
I am struggling to set every recipient in a mail to BCC, i have created a listbox with mailadresses but obviously i dont want all the customers to see each others emailadresses so i am trying to set them all to bcc. Here is the code what i have, and i just cant find the command to set them to BCC.
Sub eMailDocument()
Dim AppOutlook As Outlook.Application
Dim OL As Object
Dim EmailItem As Object
Dim y As Long
Dim TempChar As String
Dim SaveName As String
Dim i As Long
Application.ScreenUpdating = False
Set OL = CreateObject("Outlook.Application")
Set EmailItem = OL.CreateItem(olMailItem)
With EmailItem
.Subject = "U heeft post ontvangen in U HuurEenBox postbox."
.Body = "Beste HuurEenBox klant," & vbCrLf & vbCrLf & "Er is post voor u binnengekomen in uw HuurEenBox postbox. Deze kunt U afhalen bij het HuurEenBox filiaal in Aalsmeer." & vbCrLf & vbCrLf & "Met vriendelijke groet," & vbCrLf & "Het team van HuurEenBox."
For i = 0 To ListBox2.ListCount - 1
.Recipients.Add ListBox2.List(i, 0)
Next i
.Importance = olImportanceNormal 'Or olImportanceHigh Or olImportanceLow
On Error GoTo fout
.Send
End With
Application.ScreenUpdating = True
Set OL = Nothing
Set EmailItem = Nothing
MsgBox ("Rapport verzonden")
GoTo eind
fout:
MsgBox ("Outlook moet toestemming krijgen om de mail te kunnen versturen, verstuur bericht opnieuw.")
eind:
End Sub
please ignore the dutch in the msgboxes and mailbody
TIA
Frank
*edit*
i tried inserting this just after declaring the recipients but that doesnt seem to work
For Each recipient In .Recipients
Set .Type = olBCC
Next recipient
i also try to use a variable and dim that as a recipient but that generates the same error messages, i am quite lost with this atm.
TIA
frank
*edit*