Solved

programmin outlook97

Posted on 2000-04-28
3
155 Views
Last Modified: 2010-05-02
I simply need to create one mail message and mail it to a distribution list.

The dist list is read in from a file, the msg body is stored in a string variable.

Can someone show me some vba code to create an outlook instance, insert the names into the "To:" field, Insert the msg and send the letter.

0
Comment
Question by:rutledgj
3 Comments
 

Expert Comment

by:Surojitseal
Comment Utility
Use the following code :-

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long


Private Sub Command1_Click()
Dim x As Long
 x = ShellExecute(Form1.hwnd, "Open", "Mailto:someone@somewhere.com?Subject=Happy Birthday", " ", " ", 1)
End Sub



Thats all :)
0
 
LVL 6

Expert Comment

by:Marine
Comment Utility
See this Link Scroll down there is a tutorial how you can do this.

http://msdn.microsoft.com/library/officedev/office97/web/005.htm#CH005H101
0
 
LVL 1

Accepted Solution

by:
jgravelle earned 100 total points
Comment Utility
This is how you would go about it.

Dim appObj As New Outlook.Application
Dim itemObj As Object


Set itemObj = appObj.CreateItem(olMailItem)
itemObj.To = "To your dist list."
itemObj.Body = "Here is the body of the message"
itemObj.Subject = "Here is the Subject"
itemObj.Send

Set itemObj = Nothing
Set appObj = Nothing
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

772 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

12 Experts available now in Live!

Get 1:1 Help Now