+ Reply to Thread
Results 1 to 7 of 7

Outlook - Save Worksheet as PDF and attach to outlook mail

  1. #1
    Registered User
    Join Date
    10-24-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    56

    Post Outlook - Save Worksheet as PDF and attach to outlook mail

    hi,

    I have userform with textbox "FileName" and "Send" button.

    I need to save current sheet "Sheet1" as PDF and name it as entered in "FileName" then attach it to outlook once you click "Send"

    Please help!

  2. #2
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Outlook - Save Worksheet as PDF and attach to outlook mail

    Hi,
    try this
    Dont forget to select Outlook Object Library in the references under Tools

    Sean


    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-24-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: Outlook - Save Worksheet as PDF and attach to outlook mail

    Hi thank you for the code! I am getting an error tho,

    Run-time error '1004'.
    Application-defined or operation-defined error.

    ActiveSheet.ExportAsFixedFormat _
    Type:=xlTypePDF, _
    FileName1:=Fname


    Ive created a new excel file with new userform and when i run the code it doest attach the PDF
    Last edited by kaurka; 11-01-2012 at 06:37 PM.

  4. #4
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Outlook - Save Worksheet as PDF and attach to outlook mail

    Hi,
    try this one
    ive tested it and it works ok

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-24-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: Outlook - Save Worksheet as PDF and attach to outlook mail

    Sean.

    This line keeps giving me issues

    ActiveSheet.ExportAsFixedFormat _
    Type:=xlTypePDF, _
    FileName:=FName

  6. #6
    Registered User
    Join Date
    10-24-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: Outlook - Save Worksheet as PDF and attach to outlook mail

    Finally worked! God bless!

  7. #7
    Registered User
    Join Date
    10-24-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: Outlook - Save Worksheet as PDF and attach to outlook mail

    Sean,
    Unfortunately i am getting an error when i try the code on my Sheet with multiple data. It works fine on new sheet with single cell filled, but when i try running on my sheet with a table it gives me an error

    "run-time error '1004' application-defined or object-defined error"

    On line:

    ActiveSheet.ExportAsFixedFormat _
    Type:=xlTypePDF, _
    FileName1:=Fname

    Please advise!

    thx

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1