+ Reply to Thread
Results 1 to 20 of 20

VBA - Save, and Embed in Email (Outlook)

  1. #1
    Registered User
    Join Date
    05-31-2013
    Location
    Somewhere
    MS-Off Ver
    Microsoft 365
    Posts
    80

    VBA - Save, and Embed in Email (Outlook)

    I have a multipage workbook. What I am wanting is that when a button is clicked, for it to open up the save menu to save one specific page into PDF (worksheet called "Absence Memo"). Once saved, I want it to embed the same page into an email.

    Is this possible?

    Please let me know if you require any more information.

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: VBA - Save, and Embed in Email (Outlook)

    Embed in an email? or attach?
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Registered User
    Join Date
    05-31-2013
    Location
    Somewhere
    MS-Off Ver
    Microsoft 365
    Posts
    80

    Re: VBA - Save, and Embed in Email (Outlook)

    I would prefer it to be embedded.

  4. #4
    Registered User
    Join Date
    05-31-2013
    Location
    Somewhere
    MS-Off Ver
    Microsoft 365
    Posts
    80

    Re: VBA - Save, and Embed in Email (Outlook)

    Would it also be possible to do it so when it opens up in Outlook that another worksheet automatically prints (worksheet "Wall Memo")?

  5. #5
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: VBA - Save, and Embed in Email (Outlook)

    Perhaps embeding as html then? I guess I'm struggling with why the conversion to pdf if its going to be the body of an email. If you're using outlook, it will allow embedding images because they are rendered in place, but a I don't know of any way (or reason) to do so with a .pdf filetype.

  6. #6
    Registered User
    Join Date
    05-31-2013
    Location
    Somewhere
    MS-Off Ver
    Microsoft 365
    Posts
    80

    Re: VBA - Save, and Embed in Email (Outlook)

    My reasoning behind it is that we need to have a saved PDF copy of what we sent on record, so I thought it would save a step later on. But if you have another suggestion I am open to ideas!

  7. #7
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: VBA - Save, and Embed in Email (Outlook)

    I think that sounds like a grand idea, but if you want it in a .pdf file format and what it sent via outlook email, it will have to be as an attachment. If you want it to be in the body (where it will have to be saved as an email) then you can do it with html.

  8. #8
    Registered User
    Join Date
    05-31-2013
    Location
    Somewhere
    MS-Off Ver
    Microsoft 365
    Posts
    80

    Re: VBA - Save, and Embed in Email (Outlook)

    Attachment works then.

  9. #9
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: VBA - Save, and Embed in Email (Outlook)

    Try
    Please Login or Register  to view this content.
    Copy this into a module. You can call if from a button on the page you would like to send. I have placed ''' where you can enter the email address, subject, and body of email. Will the email address me constant?

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    05-31-2013
    Location
    Somewhere
    MS-Off Ver
    Microsoft 365
    Posts
    80

    Re: VBA - Save, and Embed in Email (Outlook)

    The email addresses will not be constant. The user would have to manually enter the contacts.

    I tried entering the code, but I got this error message:

    error1.JPG

  11. #11
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: VBA - Save, and Embed in Email (Outlook)

    It might have gotten pasted into a funny spot. I looks like you have an "email sub" right above it that doesn't need to be there. Just copy and paste the code above into its own module. When that is complete assign the button to this macro: "Workbook_To_PDF" not to the function. Do you want the user to pick the email address from outlook? Or will it come from a cell etc on the sheet?

  12. #12
    Registered User
    Join Date
    05-31-2013
    Location
    Somewhere
    MS-Off Ver
    Microsoft 365
    Posts
    80

    Re: VBA - Save, and Embed in Email (Outlook)

    They will be picking their own email addresses, it will not be coming from the excel sheet. I tested it out, but I see it publishing the spreadsheet, and then nothing happens after that. I noticed a few spots where it says "send automatically"... do I need to remove that code so I can enter in email addresses?

  13. #13
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: VBA - Save, and Embed in Email (Outlook)

    Please Login or Register  to view this content.
    Change this true to false. It should be the only one you need to change.

  14. #14
    Registered User
    Join Date
    05-31-2013
    Location
    Somewhere
    MS-Off Ver
    Microsoft 365
    Posts
    80

    Re: VBA - Save, and Embed in Email (Outlook)

    Thank you so much for all your help today. This should be my last question. I see it pdf's the whole workbook. I am really only wanting one page of that workbook pdf'ed. I have gone through the code to figure out where I change this, but its not working. Do you mind pointing me in the right direction?

    Thanks a bunch!

  15. #15
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: VBA - Save, and Embed in Email (Outlook)

    Is it always the same worksheet in the workbook? (i.e. the one with the button) or does it vary?

  16. #16
    Registered User
    Join Date
    05-31-2013
    Location
    Somewhere
    MS-Off Ver
    Microsoft 365
    Posts
    80

    Re: VBA - Save, and Embed in Email (Outlook)

    I will always be the same

  17. #17
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: VBA - Save, and Embed in Email (Outlook)

    Can you attach your work? It will be easier for me to edit what you have rather that try to add on it without seeing it in context.

  18. #18
    Registered User
    Join Date
    05-31-2013
    Location
    Somewhere
    MS-Off Ver
    Microsoft 365
    Posts
    80

    Re: VBA - Save, and Embed in Email (Outlook)

    See attached.

    Thanks

    Alert Chart - 2012-13.xlsm

  19. #19
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: VBA - Save, and Embed in Email (Outlook)


  20. #20
    Registered User
    Join Date
    05-31-2013
    Location
    Somewhere
    MS-Off Ver
    Microsoft 365
    Posts
    80

    Re: VBA - Save, and Embed in Email (Outlook)

    Awesome.

    Thanks so much for all your help!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. give option to save if outlook is not configured for sending email
    By pankajy18 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-11-2013, 11:53 AM
  2. Outlook : Auto Save Email body to Word / Text
    By sgcareerman in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-04-2012, 10:23 AM
  3. Save range and send as outlook email
    By hejbeiter in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-30-2012, 12:50 PM
  4. VB to save word doc with a filename just copied from an Outlook email
    By chrisvelnet in forum Outlook Programming / VBA / Macros
    Replies: 1
    Last Post: 08-09-2011, 09:28 AM
  5. save email in Outlook
    By Jessebraswell in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-23-2009, 10:27 AM

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