PDA

View Full Version : VBA code to send excel sheet as PDF



mattyb89
08-07-2012, 11:15 PM
Hello,

So my knowledge of VB is basic but i do still understand ...

I have the following code ..


Sub Macro2()
'
' Macro2 Macro
'

'
Sheets("REPORT DETAILED ").Select
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, Filename:="Health Check Detailed.pdf" _
, Quality:=xlQualityStandard, IncludeDocProperties:=False, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
Application.Dialogs(xlDialogSendMail).Show _
arg1:=Sheets("HEALTHCHECK").Range("AP19"), _
arg2:=Sheets("HEALTHCHECK").Range("AP20")

End Sub

This is ment to attach the worksheet "Detailed Report" as a PDF. So far i can get it reference the email and the subject but how do i add a body part ?

Also the attached file only comes across as an excel file, and its the whole book.

Any help would be appreciated.

Thanks

mancubus
08-07-2012, 11:58 PM
wellcome to the forum.

please wrap your code with vba tags. clicking "green VBA button" will do it for you.

see if this helps:
http://www.vbaexpress.com/forum/showthread.php?t=26498

mancubus
08-08-2012, 12:00 AM
ooops.

when i saw the word "send" in the title, i thought it was about converting the worksheet to pdf and emailing the pdf file.

mancubus
08-08-2012, 01:27 AM
i seem to have concentration problem... :banghead: