Beste ik heb een code om diverse tabbalden per mail te versturen.
Deze werkt perfect maar ik moet eerst alle e-mail adressen invoeren om bv.alleen tabblad K35 te versturen.
Weet iemand hier een oplossing voor?
Bij voorbaat al bedankt.
Deze werkt perfect maar ik moet eerst alle e-mail adressen invoeren om bv.alleen tabblad K35 te versturen.
Weet iemand hier een oplossing voor?
Bij voorbaat al bedankt.
Code:
Sub OPTPDF()
rz = Sheets("Vakkaart").Range("B10").CurrentRegion
For d = 2 To UBound(rz)
If rz(d, 1) = "E-mail" Then tomail = tomail & rz(d, 2) & ";"
Next
For i = 1 To 35
Application.ScreenUpdating = False
Sheets("K" & i).Visible = xlSheetVisible
If InStr(1, tomail, Sheets("K" & i).Range("F10").Value, vbTextCompare) Then
With Sheets("K" & i)
Fname = .Range("F10").Value & ".pdf"
eAddress = .Range("F7").Value
.ExportAsFixedFormat 0, ThisWorkbook.Path & "\" & Fname
End With
With CreateObject("Outlook.application").CreateItem(0)
.To = eAddress
.Subject = ""
.Body = " maand" _
& vbNewLine & "" _
& vbNewLine & ""
.Attachments.Add ThisWorkbook.Path & "\" & Fname
.Send
End With
Kill ThisWorkbook.Path & "\" & Fname
Else
'' Sheets("ORT" & i).Range("C10:N62").PrintPreview '.printout
End If
Next
Application.ScreenUpdating = True
End With
End Sub