?
Solved

Outlook e-mail automation

Posted on 2000-04-12
2
Medium Priority
?
140 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
SMosher earned 300 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

649 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