I have found and copied the vba code to convert and email a worksheet as a pdf file but want to to send the file to email addresses within a range of cells within that worksheet. for example
A1 [email protected]
A2 [email protected]
A3 [email protected]
I currently use this to send the worksheet without converting to pdf from Ron De Bruin's website.
Dim rng As Range
Dim Arr() As String
Dim N As Integer
Dim cell As Range
Set rng = ThisWorkbook.Sheets("Letter Template").Range("b13:B15")
ReDim Preserve Arr(1 To rng.Cells.Count)
N = 0
For Each cell In rng
If cell.Value Like "?*@?*.?*" Then
N = N + 1
Arr(N) = cell.Value
End If
Next cell
ReDim Preserve Arr(1 To N)
.SendMail Arr, "Margin Report"
this is the part of the code to send excel worksheet as pdf file.
FileName = RDB_Create_PDF(ActiveSheet, "", True, False)
If FileName <> "" Then
RDB_Mail_PDF_Outlook FileName, "[email protected]", "This is the subject", _
"See the attached PDF file with the last figures" _
& vbNewLine & vbNewLine & "Regards Jane Doe", False
Else
MsgBox "Not possible to create the PDF, possible reasons:" & vbNewLine & _
"Microsoft Add-in is not installed" & vbNewLine & _
"You Canceled the GetSaveAsFilename dialog" & vbNewLine & _
"The path to Save the file in arg 2 is not correct" & vbNewLine & _
"You didn't want to overwrite the existing PDF if it exist"
End If
End Sub
hope this makes sense.
Bookmarks