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
 

AgentSmith

Well-known Member
Joined
Mar 8, 2004
Messages
575
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.
 

billyheiman

New Member
Joined
Nov 21, 2005
Messages
4
Great, Now I know it can be done and with the info provided im sure to get it.

Thanks =)

Billy
 

Forum statistics

Threads
1,078,094
Messages
5,338,193
Members
399,212
Latest member
Braincraft

Some videos you may like

This Week's Hot Topics

Top