在已发送邮件中找到会议请求时,访问VBA不会出错

时间:2019-07-05 12:58:17

标签: vba access-vba

我正在扫描“已发送电子邮件”中是否有发送到特定电子邮件地址的电子邮件。我的问题是,一旦会议邀请被点击,下一行的调试错误“类型不匹配”

下面是我的完整代码-有人可以显示我应该如何修改我的代码以使其按需执行吗?

Function rst()
Dim searchEmail As String
Dim olApp As Outlook.Application
Dim olNS As Namespace 
Dim Fldr As MAPIFolder
Dim olMail As Outlook.MailItem
Dim olReply As Outlook.MailItem
Set olApp = New Outlook.Application
Set olNS = olApp.GetNamespace(“MAPI”)
Set Fldr = olNS.GetDefaultFolder(olFolderSentMail)

For Each olMail In Fldr.Items
  If olMail.To = searchEmail Then
    Debug.Print “Found It”
  End If
Next olMail
End Function

0 个答案:

没有答案