Villalobos
Active Member
Hello, I use the following code to create a pdf copy about the active sheet and after attach to the standard email. My problem is that the output paper size of pdf file is A4, is there any way to set A3 size in the code?
Many thanks the response!
Code:
Sub SendSchedulingToPDFandMail()
Dim Wb As Workbook
Dim FileName As String
Dim OutlookApp As Object
Dim OutlookMail As Object
Set Wb = Application.ActiveWorkbook
FileName = Wb.FullName
xIndex = VBA.InStrRev(FileName, ".")
If xIndex > 1 Then FileName = VBA.Left(FileName, xIndex - 1)
FileName = FileName & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=FileName
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMail = OutlookApp.CreateItem(0)
With OutlookMail
.To = "..."
'.CC = "..."
.BCC = "..."
.Subject = "..." & " " & Date
.Body = "Hello," & vbNewLine & vbNewLine & "..." & vbNewLine & vbNewLine & vbNewLine & Application.UserName
.Attachments.Add FileName
.Send
End With
Kill FileName
Set OutlookMail = Nothing
Set OutlookApp = Nothing
End Sub
Many thanks the response!