+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 19

Create Emails and Save it to Folder

  1. #1
    Registered User
    Join Date
    11-11-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    13

    Create Emails and Save it to Folder

    Good evening,

    I have attached code to convert a workheet to pdf, create an outlook email and attach created pdf to created email. On created email subject is delivery reference which is a range.

    Currently I am using it without any problem. But it creates only one email. What i am trying to do is creating seperate emails with delivery reference numbers. For example currently I have 5 different delivery numbers as a result i want to create 5 emails. Subject of these emails should be delivery numbers.

    Second goal is to save these emails to folder. I could not figure out it so far. I tried .SaveAs ("folder path"), it did not return error, did not work either.

    I would like to know if these objectives are possible if an excel master would like to help.

    Thanks,
    Attached Files Attached Files

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    XL 2010,2016
    Posts
    12,160

    Re: Create Emails and Save it to Folder

    Did you want to loop through those 5 cells?

    Please Login or Register  to view this content.
    Last edited by davesexcel; 11-26-2019 at 07:48 AM.

  3. #3
    Registered User
    Join Date
    11-11-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    13

    Re: Create Emails and Save it to Folder

    Hi davesexcel,

    Thanks for your reply. Yes this is what I would like to. Range is fixed, however in some occasions a cell in between that range can be blank. In that case I dont want code to create an email for blank cell.

    And as a second goal, I could not understand why .SaveAs does not work.

    Thanks,
    Attached Files Attached Files

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    XL 2010,2016
    Posts
    12,160

    Re: Create Emails and Save it to Folder

    I edited the code in case c=""

    What is happening with the saveas?
    Last edited by davesexcel; 11-26-2019 at 07:52 AM.

  5. #5
    Registered User
    Join Date
    11-11-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    13

    Re: Create Emails and Save it to Folder

    Hi davesexcel,

    It works perfect thanks.

    When I try to .SaveAs created emails as.msg, i dont see any error message, just does not save anything

  6. #6
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    XL 2010,2016
    Posts
    12,160

    Re: Create Emails and Save it to Folder

    I don't see a saveas in the code

  7. #7
    Registered User
    Join Date
    11-11-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    13

    Re: Create Emails and Save it to Folder

    Hi davesexcel,

    I removed it because i was ashamed. Sorry for that. Below is what i have tried vey unsuccessfully


    Please Login or Register  to view this content.

    What happens is, instead of saving created emails, above code saves pdf file to desktop

  8. #8
    Registered User
    Join Date
    11-11-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    13

    Re: Create Emails and Save it to Folder

    hi,

    still no luck. Could it be related to object ?

  9. #9
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    UK
    MS-Off Ver
    2016 primarily
    Posts
    3,853

    Re: Create Emails and Save it to Folder

    Change the SaveAs line from:

    Please Login or Register  to view this content.
    to:

    Please Login or Register  to view this content.
    since you want to save the message, not the application.
    Rory
    Days when we raged, we flew off the page
    Such damage was done

  10. #10
    Registered User
    Join Date
    11-11-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    13

    Re: Create Emails and Save it to Folder

    Good afternoon,

    I changed and tried, still no luck. It still creates emails however none of them are saved

  11. #11
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    UK
    MS-Off Ver
    2016 primarily
    Posts
    3,853

    Re: Create Emails and Save it to Folder

    You're missing a backslash on the end of the path here:

    Please Login or Register  to view this content.

  12. #12
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    Excel 2007
    Posts
    6,332

    Re: Create Emails and Save it to Folder

    My guess is that the error lies here.

    Please Login or Register  to view this content.
    You don't create a name for the file since m.Subject is empty.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  13. #13
    Registered User
    Join Date
    11-11-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    13

    Re: Create Emails and Save it to Folder

    Quote Originally Posted by rorya View Post
    You're missing a backslash on the end of the path here:

    Please Login or Register  to view this content.
    I added a backslash but nothing changed. still does not save emails

  14. #14
    Registered User
    Join Date
    11-11-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    13

    Re: Create Emails and Save it to Folder

    Quote Originally Posted by bakerman2 View Post
    My guess is that the error lies here.

    Please Login or Register  to view this content.
    You don't create a name for the file since m.Subject is empty.

    Hi, i am sorry I did not understand what do you mean

  15. #15
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    UK
    MS-Off Ver
    2016 primarily
    Posts
    3,853

    Re: Create Emails and Save it to Folder

    Move the:

    Please Login or Register  to view this content.
    line above the SaveAs, then tell us what the error message is.

+ Reply to Thread
Page 1 of 2 1 2 LastLast

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