Convert to PDF --> attach to email

billyheiman

New Member
Joined
Nov 21, 2005
Messages
4
Is it possible to create a macro or vb script to have a button to convert the sheet to a pdf then atatch it to an email, via Outlook?

Thanks,
Billy
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
The short answer is "Yes" ;)

To create an email with a PDF attachment in Outlook you need to add a reference to the "Microsoft Outlook (number) Object Library". Then use code like this:
Code:
    Dim olApp As Outlook.Application
    Dim olEmail As Outlook.MailItem
    
    Set olApp = New Outlook.Application
    Set olEmail = olApp.CreateItem(olMailItem)
    
    With olEmail
        'set up addresses, subject and body text as required
        .Attachments.Add "C:\mydoc.pdf"
    End With
    
    Set olEmail = Nothing
    Set olApp = Nothing
The tricky part is making the PDF file in the first place. You'll need another reference to some software that allows you to automate creating PDFs. Maybe you have access to Acrobat Professional? I'm sure that will let you do it somehow. If you need a freebie then it looks like this might do it too:

http://www.primopdf.com/

I think Primo works by giving you an additional printer, so all you'd have to do is print the pages you want using the PDF printer.

Hope this helps.
 
Upvote 0

Forum statistics

Threads
1,214,399
Messages
6,119,279
Members
448,884
Latest member
chuffman431a

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