VBA to export to pdf then send by email

Gassiusmax

New Member
Joined
May 27, 2014
Messages
18
Hi Guys, I know it seems to be a hot question but I can not seem to resolve what I am aiming for.

I would like to be able to export to PDF with the file name based on a cell reference, and then email the PDF with the email addresses within a set range on the spreadsheet

Code:
<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit;">Private Sub CommandButton1_Click()'This macro opens the SaveAs option with the defult file path "you have to set this file path below" coverts the whole sheet into .pdf file format'And opens the .pdf to view <-- you can disable the view after covert option with lower code: OpenAfterPublish:=False    pdfName = ActiveSheet.Range("D4")    ChDir "C:\DROPBOX\DATA PLAN CONFIRMATIONS" 'This is where youo set a defult file path.   fileSaveName = ActiveSheet.Range("D4")         ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _        fileSaveName _        , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _        :=False, OpenAfterPublish:=False            Set Mail_Object = CreateObject("Outlook.Application")        End Sub

</code>

is what I have so far but i can not seem to progress it to the final stage. as far as automation goes I do not need any messages until the end when email is sent or not sent

Thanks in advance for any input

Dan
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Forum statistics

Threads
1,215,999
Messages
6,128,196
Members
449,432
Latest member
Novice Excel User

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top