Solved

Outlook e-mail automation

Posted on 2000-04-12
2
131 Views
Last Modified: 2010-05-02
I need for my application to create a new Outlook e-mail item in a specific Outlook folder. The problem is that my new message always goes to the Drafts folder not the folder that I created. Here is my code:

'after creating the Outlook app object and opening a namespace, I get the default OutBox folder
  Set olOFolder = olNameSpace.GetDefaultFolder(olFolderOutbox)

'set a folder object to my folder which is a subfolder in the Outbox
  Set olMyFolder = olOFolder.Folders("My Folder")

'add new mail item to my folder
  Set olItem = olMyFolder.Items.Add(olMailItem)
'set MailItem properties and save item
  With olItem
    .Subject = Subject
    .Recipients.Add Recipient
    .Body = Message
    .Save
  End With
0
Comment
Question by:STKeith
2 Comments
 
LVL 3

Accepted Solution

by:
SMosher earned 100 total points
ID: 2710504
This seems to be a peculiarity of the default message form. I have not finished playing around with it myself, but have it on good authority that, if you use a custom form instead of the default, this doesn't happen.

Another possible solution would be to use the Move method on the item after you Save it.
0
 

Author Comment

by:STKeith
ID: 2712866
I guess I'll just have to settle for moving the file after it's created. Thanks.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now