+ Reply to Thread
Results 1 to 19 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
    MS 365
    Posts
    13,475

    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
    MS 365
    Posts
    13,475

    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
    MS 365
    Posts
    13,475

    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
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    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

  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
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    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
    MO Prof Plus 2016
    Posts
    6,907

    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
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    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.

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

    Re: Create Emails and Save it to Folder

    Hello,

    When i changed
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    , it creates only one email and returns object required error and highlights
    Please Login or Register  to view this content.

  17. #17
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    Re: Create Emails and Save it to Folder

    Remove the m from that line. It should just be:

    Please Login or Register  to view this content.
    Last edited by rorya; 12-10-2019 at 10:17 AM.

  18. #18
    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
    Remove the m from that line. It should just be:

    Please Login or Register  to view this content.
    Hi rorya, you are legend! it works perfect. Now I will dig how to close these created emails after saving. Thanks for your help much appreciated
    Last edited by metalscuba; 12-10-2019 at 10:47 AM.

  19. #19
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    Re: Create Emails and Save it to Folder

    Glad to 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. How To Save Outlook Emails To Folder
    By Frenzyy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-13-2019, 01:04 PM
  2. automatically Save sent emails to a local folder
    By drnote5238 in forum Outlook Programming / VBA / Macros
    Replies: 0
    Last Post: 11-21-2017, 08:04 PM
  3. Create Folder & Check if Folder Exists if Not Create Folder & then Save File
    By Quivolt in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-28-2017, 05:31 AM
  4. Save and rename emails to a folder on the server
    By nathandavies9 in forum Outlook Formatting & Functions
    Replies: 0
    Last Post: 02-21-2017, 01:39 PM
  5. [SOLVED] Loop Through Folder, Create Emails with Sub Folder Names in Subject, Attach files in sub
    By Rschwar23 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-30-2015, 10:06 AM
  6. Save emails sent on behalf of another mailbox in correct sent items folder
    By Domski in forum Outlook Programming / VBA / Macros
    Replies: 0
    Last Post: 04-06-2010, 12:53 PM
  7. Replies: 6
    Last Post: 08-11-2006, 03:41 PM

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