Visual Basic Outlook上次写入时间

时间:2017-06-16 16:19:39

标签: vba outlook outlook-vba

此VB脚本将获取Outlook收件箱中的所有电子邮件。

Sub DetermineLastWriteTime()
    Dim myNameSpace As Outlook.NameSpace
    Dim myInbox As Outlook.Folder
    Dim myItems As Outlook.Items
    Dim myItem As Object

    Set myNameSpace = Application.GetNamespace("MAPI")
    Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox)
    Set myInboxItems = myNameSpace.GetDefaultFolder(olFolderInbox).Items

    MsgBox (myInboxItems.LastWriteTime)
End Sub

我想确定 n 分钟内未修改过的电子邮件。具有LastWriteTime功能的消息框产生一个弹出框,消息对象不支持此属性或方法

enter image description here

还有其他方法可以确定 n 分钟内未修改过的电子邮件吗?

1 个答案:

答案 0 :(得分:2)

ConnectionString = "Provider=SQLOLEDB;SERVER=DWSQL\User;Database=User;Uid=User;Pwd=User;" If Sheets("Menu").Cells(4, 4) = "SC" Then Sql = "SELECT * FROM [MVS].[dbo].[trpos_process] where fc = '2' and process = 'ASSEMBLY' and status = 'NEW'" ElseIf Sheets("Menu").Cells(4, 4) = "MC" Then Sql = "SELECT * FROM [MVS].[dbo].[trpos_process] where fc = '3' and process = 'ASSEMBLY' and status = 'NEW'" 'and startby is Null" ElseIf Sheets("Menu").Cells(4, 4) = "EV" Then Sql = "SELECT * FROM [MVS].[dbo].[trpos_process] where fc = '5' and process = 'ASSEMBLY' and status = 'NEW' and pos_no like 'EN5%'" End If Connection.Open ConnectionString rs.Open Sql, Connection, adOpenStatic, adLockReadOnly Range("b2").CopyFromRecordset rs rs.Close: QT.Delete: Connection.Close 似乎不是来自Outlook的属性,所以不确定它来自哪里?

此外,您尝试在一组商品上调用该商品,而不是在每件商品上调用。

尝试类似:

LastWriteTime