J
jatman
good afternoon,
i have the followign macro:
Sub Mail_ActiveSheet_PDF_Outlook()
'Note: It is easy to change the code to send a workbook, selection or range.
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim FilenameStr As String
FilenameStr = "C:\Purchase Orders\" & _
Format(Now, "yyyy-mm-dd, ") & "PO# " & Range("M5").Value & ", " &
Range("H5").Value & ".pdf"
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=FilenameStr, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
strbody = ""
On Error Resume Next
With OutMail
.To = "(e-mail address removed)"
.Subject = "PO# " & Range("M5").Value & ", " & Range("H5").Value
.Body = strbody
.Attachments.Add FilenameStr
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
everything works fine, except i want to add a CC recipient as follows:
there are two cells were an email address may be (D9 and H9). these cells
could be blank, have a "0" value because there is no email address to
reference or have an email address. if there is an email address in either
of the two fields, then they will also receive the email, otherwise, it will
only got to the defaul recipient in the macro.
can those cells be referenced as value... range("d9").value?
jat
i have the followign macro:
Sub Mail_ActiveSheet_PDF_Outlook()
'Note: It is easy to change the code to send a workbook, selection or range.
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim FilenameStr As String
FilenameStr = "C:\Purchase Orders\" & _
Format(Now, "yyyy-mm-dd, ") & "PO# " & Range("M5").Value & ", " &
Range("H5").Value & ".pdf"
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=FilenameStr, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
strbody = ""
On Error Resume Next
With OutMail
.To = "(e-mail address removed)"
.Subject = "PO# " & Range("M5").Value & ", " & Range("H5").Value
.Body = strbody
.Attachments.Add FilenameStr
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
everything works fine, except i want to add a CC recipient as follows:
there are two cells were an email address may be (D9 and H9). these cells
could be blank, have a "0" value because there is no email address to
reference or have an email address. if there is an email address in either
of the two fields, then they will also receive the email, otherwise, it will
only got to the defaul recipient in the macro.
can those cells be referenced as value... range("d9").value?
jat