Results 1 to 6 of 6
  1. #1
    scotwithadevil is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Oct 2016
    Posts
    3

    Use CDO in Access VBA to create an email in DRAFTS folder in Outlook.Com

    Hi
    I have created the code to SEND an email to a BCC group from my Outlook.com email address but I want to store it in DRAFTS instead as the email has to be checked and slightly ordered each time before it is actually sent. I know how to set up the addresses in the BCC line (I have some other code, which I haven't included, to do that).

    I have wasted hours and hours on this and would be so grateful for help.
    I did have code that just used normal MS Outlook but after an upgrade to Windows 10, I can't get MS Outlook to work so I have re-written the code to use Outlook Live.

    This is my code:
    On Error GoTo sendoutlookliveemail_Click_Err
    Set MyEmail = CreateObject("CDO.Message")

    MyEmail.Subject = "Test"
    MyEmail.To = "recipient@btinternet.com"
    MyEmail.From = "sender@outlook.com"
    MyEmail.TextBody = "Is this working?"

    Set emailConfig = MyEmail.Configuration
    emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp-mail.outlook.com"
    emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25


    emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "sender@outlook.com"
    emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "sender passwordl"
    emailConfig.Fields.Update
    MyEmail.Configuration.Fields.Update

    ‘This is the line that is not working
    MyEmail.Save

    ‘So I am currently using this instead
    MyEmail.Send

    Set MyEmail = Nothing

    sendoutlookliveemail_Click_Exit:
    Exit Sub

    sendoutlookliveemail_Click_Err:
    MsgBox Err.Number & " " & Err.Description
    Resume sendoutlookliveemail_Click_Exit
    End Sub

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    CDO is old and Outlook.com is newer. What is it you are trying to do? Are you trying to interact with you online Office 365? I think the only way to do that is via Windows Presentation Foundation and .NET. At least, the only examples I have seen is using WPF. I know Office is offering new SDK's all of the time.

    Anyway, for the older version of Outlook express you might have been able to do something via CDO.
    https://msdn.microsoft.com/en-us/lib...exchg.10).aspx

  3. #3
    scotwithadevil is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Oct 2016
    Posts
    3
    Hi
    Thanks for taking the time to answer this. Frustratingly, my old code worked really well with desktop Outlook but I am now trying to interact with Outlook online and can no longer get it to save in Drafts as there doesn't appear to be a .SAVE command.
    It was enough of a test of my skills to change the code to the above so that I could use .SEND
    I'm not sure I have the skills to use WPF - I don't know what that is but will investigate.
    Thanks again for taking the time to respond.

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Do you have a desktop version of Outlook installed? You should be able to use your online account with your desktop Outlook Application. From there, you can use Access to automate Outlook. Then Outlook will synchronize with the online server.

  5. #5
    scotwithadevil is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Oct 2016
    Posts
    3
    No. The guy I am trying to do this for has upgraded to Windows 10 and can't get desktop Outlook to load on his machine (thank you MS!) so has set up an Outlook.com account instead. I have now suggested a trip to KnowHow to get the desktop version working! Think that will be a much easier solution than spending any more hours on this code.

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    OK, not sure what the issue with installing Office on W10 is. Of course, trying to buy anything that is not Office 365 is an adventure. So, maybe that was the issue.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 16
    Last Post: 08-13-2016, 11:44 AM
  2. Replies: 5
    Last Post: 11-24-2015, 04:31 PM
  3. can I create/update an Outlook email group from my Access data?
    By jimdharris in forum Import/Export Data
    Replies: 2
    Last Post: 08-31-2015, 10:07 AM
  4. creating folder from Ms access in outlook
    By capitala in forum Programming
    Replies: 5
    Last Post: 03-08-2013, 10:05 PM
  5. issue with linking outlook folder to access
    By live2ride in forum Import/Export Data
    Replies: 7
    Last Post: 12-20-2012, 12:24 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums