标签:
Option Explicit Sub TestFolder() ‘Dim outlookapp, myitem, myfolder ‘Dim mailcounts As Integer ‘ ‘ ‘Set outlookapp = CreateObject("outlook.application") ‘ Set myitem = outlookapp.Application.GetNamespace("mapi") ‘ Set myfolder = myitem.GetDefaultFolder(olFolderInbox).Folders("AnualParty15") ‘ mailcounts = myfolder.Items.Count ‘ ‘ Debug.Print mailcounts Dim mobjOutlook As Outlook.NameSpace Dim objOutlook As New Outlook.Application Dim objFolder As Outlook.Folder Set mobjOutlook = objOutlook.GetNamespace("MAPI") Set objFolder = mobjOutlook.GetDefaultFolder(olFolderInbox).Folders("AnualParty15") Dim objMail As Outlook.MailItem For Each objMail In objFolder.Items Debug.Print objMail.SenderEmailAddress, objMail.Sender, objMail.Subject, objMail.ReceivedTime Next End Sub
标签:
原文地址:http://www.cnblogs.com/jiceberg420/p/4671054.html