Solved

Opening Oulook Express From Visual Basic

Posted on 2001-06-13
4
208 Views
Last Modified: 2013-11-25
How do i open up an Outlook express from VB to send a Mail?
0
Comment
Question by:kannanonline
[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
4 Comments
 
LVL 12

Expert Comment

by:roverm
ID: 6186917
This should do the trick:

Private Sub Command1_Click()
Dim objOutlook As Object
Dim objMail As Object

    Set objOutlook = CreateObject("Outlook.Application")
    Set objMail = objOutlook.CreateItem(0)
       
    With objMail
        .To = "bill.gates@microsoft.com"
        .Subject = "MyTestMail"
        .Body = "This is the text."
        .Send
    End With
   
    Set objMail = Nothing
    Set objOutlook = Nothing
   
End Sub

D'Mzzl!
RoverM
0
 
LVL 38

Accepted Solution

by:
PaulHews earned 50 total points
ID: 6186945
That won't work because Outlook Express does not expose a useful object hierarchy like Outlook.  Here is an example that shows how to send mail using the MAPI controls that come with VB.  This will work with outlook express which is a simple mapi client (this is the only way to automate Outlook Express.)

HOWTO: How to Send/Receive E-Mail Messages with Visual Basic

http://support.microsoft.com/support/kb/articles/Q185/1/71.ASP
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7136044
Hi kannanonline,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will suggest to:

    Accept PaulHews's comment(s) as an answer.

kannanonline, if you think your question was not answered at all or if you need help, you can simply post a new comment here.  Community Support moderators will follow up.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Expert Comment

by:Computer101
ID: 7168452
Comment from expert accepted as answer

Computer101
E-E Moderator
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

759 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