View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
Posts: 3,872
Default Print, Save as PDF, Email PDF code

Hi again,

Am Sat, 9 Jul 2016 22:53:21 +0200 schrieb Claus Busch:


Sub PrintSheets()

better readable:

Sub PrintSheets()
With Sheets("Quote")
.PrintOut Copies:=1
.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"R:\emailed quotes\" & .Range("M1") & ".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
End With
Sheets("Sheet1").PrintOut Copies:=1
End Sub

Sub SendMail()
Dim objOutlook As Object, objMail As Object

Set objOutlook = CreateObject("Outlook.Application")
Set objMail = objOutlook.Createitem(0)

With objMail
.to = "claus_busch(at)"
.Subject = "Expected PDF file"
.body = "Hi Claus," & Chr(10) & Chr(10) _
& "Here is the mail with the expected PDF"
With .attachments
.Add "R:\emailed quotes\" & Sheets("Quote").Range("M1") _
& ".pdf"
End With
End With
End Sub

Claus B.
Office 2016