• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Set pdf paper size to A3

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?

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!
 
This might help..

Code:
 FileName = FileName & ".pdf"
  ActiveSheet.PageSetup.PaperSize = xlPaperA3
  ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=FileName
 
Back
Top