我有以下代码可以打开Outlook约会项目:
Public Sub OpenOutlookAppt()
Set myolApp = CreateObject("Outlook.Application")
Set objExpCal = Session.GetDefaultFolder(olFolderCalendar).GetExplorer
Set objNavMod = objExpCal.NavigationPane.Modules.GetNavigationModule(olModuleCalendar)
Set objNavGroup = objNavMod.NavigationGroups.GetDefaultNavigationGroup(olPeopleFoldersGroup)
MyCalendar = objNavMod.NavigationGroups.NavigationFolders("Trip Calendar")
EntryID = Cells(ActiveCell.Row, 22)
ReDim Newa(1 To MyCalendar.Folder.Items.count)
r = 1
For Each Item In MyCalendar.Folder.Items
Newa(r) = Item.EntryID
r = r + 1
Next Item
For r = 1 To UBound(Newa)
If Newa(r) = EntryID Then
MyCalendar.Folder.Items(r).Display
Exit Sub
End If
Next r
End Sub
此代码非常慢,因为它会循环遍历日历文件夹中的每个约会项。
会有更快的方法吗?有没有办法我可以不循环地引用我想要的项目?
我有EntryID来引用该项目,但是我可以存储该项目中的其他数据。