Sub Email4(control As IRibbonControl)
Dim IsCreated As Boolean
Dim i As Long
Dim PdfFile As String
Dim OutlApp As Object
PdfFile = ActiveWorkbook.FullName
i = InStrRev(PdfFile, ".")
If i > 1 Then PdfFile = Left(PdfFile, i - 1)
PdfFile = PdfFile & "-" & ActiveSheet.Name & ".pdf"
With Sheet3
.ExportAsFixedFormat Type:=xlTypePDF, Filename:=PdfFile, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End With
On Error Resume Next
Set OutlApp = GetObject(, "Outlook.Application")
If Err Then
Set OutlApp = CreateObject("Outlook.Application")
IsCreated = True
End If
OutlApp.Visible = True
On Error GoTo 0
With OutlApp.CreateItem(0)
.Subject = Range("Email!B4").Value
.To = Range("Email!B1").Value
.CC = Range("Email!B2").Value
.BCC = Range("Email!B3").Value
.Body = Range("Email!B5").Value
.Attachments.Add PdfFile
.Display
Application.Visible = True
On Error GoTo 0
End With
Kill PdfFile
End Sub
I do not want the name of the workbook included in the email
" PdfFile = ActiveWorkbook.FullName"
Nor the "ActiveSheet.Name "
Thanks for your help
Bookmarks