-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: Wilson
Message 3 in Discussion
Hi,srry, i cant' send my source code... becuase it is my company prj, but here i'm
attaching some modeules from MSDN or else u can directly check it in
MSDN,regards,WilsonFunction startOutlook() Dim ol As New Outlook.Application
Dim ns As Outlook.NameSpace 'Return a reference to the MAPI layer. Set ns =
ol.GetNamespace("MAPI") 'Let the user logon to Outlook with the 'Outlook
Profile dialog box, 'and then create a new session. ns.Logon , , True, True
End FunctionSub GetDefaultInbox() Dim ol As New Outlook.Application Dim ns As
Outlook.NameSpace Dim fdInbox As Outlook.MAPIFolder Set ns =
ol.GetNamespace("MAPI") 'Reference the default Inbox folder Set fdInbox =
ns.GetDefaultFolder(olFolderInbox) 'Display the Inbox in a new Explorer window
fdInbox.Display End Sub Sub NewMailMessage() Dim ol As New Outlook.Application
Dim ns As Outlook.NameSpace Dim newMail As Outlook.MailItem 'Return a
reference to the MAPI layer. Set ns = ol.GetNamespace("MAPI") 'Create a new
mail message item. Set newMail = ol.CreateItem(olMailItem) With newMail
'Add the subject of the mail message. .Subject = "Training Information for
October 1997" 'Create some body text. .Body = "Here is the training
information you requested:" & vbCrLf 'Add a recipient and test to make sure
that the 'address is valid using the Resolve method. With
.Recipients.Add("[EMAIL PROTECTED]") .Type = olTo If Not
.Resolve Then MsgBox "Unable to resolve address.", vbInformation
Exit Sub End If End With 'Attach a file as a
link with an icon. With .Attachments.Add _
("\\Training\training.xls", olByReference) .DisplayName = "Training info"
End With 'Send the mail message. .Send End With
'Release memory. Set ol = Nothing Set ns = Nothing Set newMail = Nothing
End Sub Private ol As New Outlook.Application Private ns As Outlook.NameSpace Private
itms As Outlook.Items Private Sub Form_Load() Dim fd As Outlook.MAPIFolder
Dim itm As Object 'Get to the current session of Outlook. Set ns =
ol.GetNamespace("MAPI") 'Retrieve a collection of mail messages in the inbox.
Set itms = ns.GetDefaultFolder(olFolderInbox).Items 'Loop through the items and
display the subjects of the unread 'messages in a list box on a form. For Each
itm In itms If itm.UnRead = True Then lstSubjects.RowSource =
lstSubjects.RowSource _ & itm.Subject & ";" End If Next
End Sub Private Sub lstSubjects_AfterUpdate() Dim itm As Object Dim criteria
As String 'Find the mail item with the subject currently selected 'in a list
box called lstSubjects. criteria = "[subject] = '" & lstSubjects.Value & "'"
Set itm = itms.Find(criteria) 'Place some item information into text boxes.
txtFrom = itm.SenderName txtRecieved = itm.ReceivedTime txtBody = itm.Body End
Sub
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]