Ik heb een prachtig mailscript waar ik heel blij mee ben en wat goed werkt. De geadresseerde is een vast persoon, de afzender varieert en is gerelateerd aan een cel. Nu wil ik echter dan er ook een cc verstuurd word naar een variabel adres, die ook gekoppeld is aan een andere cel. Maar wat ik ook probeer, die cc komt nooit aan. Wat mis ik?
Dit is de code:
Dit is de code:
Code:
Public Sub maildienstruil()
Dim strBcc As String
Dim strCc As String
Dim strFileName As String
Dim strFileNameFullPath As String
Dim strFrom As String
Dim strSchema As String
Dim strSubject As String
Dim strTextBody As String
Dim strTo As String
With Application
.Calculation = xlCalculationManual
.EnableEvents = False
.ScreenUpdating = False
End With
strSchema = "http://schemas.microsoft.com/cdo/configuration/"
strSubject = "dienstruil-neo"
strTo = "fdggdgfdgdfgdfg@vvdff.nl"
strFrom = Range("J5").Value
[COLOR="#FF0000"] strCc = Range("J9").Value[/COLOR]
strBcc = ""
strTextBody = "Graag wil ik jullie informeren over de volgende dienstruil-neo:"
strFileName = InputBox(prompt:="Druk alleen op OK, de dienstruil wordt dan automatisch verzonden.", Title:="Dienstruil", Default:="Dienstruil")
strFileNameFullPath = Environ$("temp") & "\" & strFileName & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=strFileNameFullPath, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, From:=1, To:=1, OpenAfterPublish:=False
With CreateObject("CDO.Message")
With .Configuration.Fields
.Item(strSchema & "sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "fgdfgdfgdfg.nl"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Update
End With
.To = strTo
.CC = ""
.BCC = ""
.From = strFrom
.Subject = strSubject
.TextBody = strTextBody
.AddAttachment strFileNameFullPath
.Send
End With
MsgBox "De dienstruil is verstuurd naar het roosterburo"
Kill strFileNameFullPath
With Application
.Calculation = xlCalculationAutomatic
.EnableEvents = True
.ScreenUpdating = True
End With
End Sub