Vba 为邀请来自外部系统的会议设置Outlook约会项目类别:对象不支持此方法
以下代码设置了与主题和正文中的文本有关的约会项目的类别 InItems的Vba 为邀请来自外部系统的会议设置Outlook约会项目类别:对象不支持此方法,vba,outlook,Vba,Outlook,以下代码设置了与主题和正文中的文本有关的约会项目的类别 InItems的是日历项的选择,包含有效项 dicCategories是一个包含搜索字符串和指定类别的字典: For Each oAppt In oFinalItems For Each Key In dicCategories.Keys If InStr(1, oAppt.Subject & oAppt.Location, Key, vbTextCompare) > 0 Then
是日历项的选择,包含有效项
dicCategories
是一个包含搜索字符串和指定类别的字典:
For Each oAppt In oFinalItems
For Each Key In dicCategories.Keys
If InStr(1, oAppt.Subject & oAppt.Location, Key, vbTextCompare) > 0 Then
strCategory = dicCategories.Item(Key)
If InStr(1, oAppt.Categories, strCategory, vbTextCompare) = 0 Then
If oAppt.Categories = "" Then
oAppt.Categories = strCategory
Else
oAppt.Categories = strCategory & ";" & oAppt.Categories
End If
oAppt.Save
End If
Exit For
End If
Next
Next
我在行中得到错误“对象不支持此方法”
oAppt.Categories = strCategory
此代码在重新安装我的电脑之前正在运行
我检查了类型,上面写着“AppointmentItem”。我刚刚发现它只适用于邀请来自外部系统的会议。如果您查看代码:
For Each oAppt In oFinalItems
Items
对象可能包含不同类型的项-MailItem、AppointmentItem、MeetingItem、DocumentItem等。并非所有这些项都定义了类别
属性
我建议在访问任何属性之前检查项目类或类型。例如:
If TypeName(Item) <> "AppointmentItem" Then
Exit Sub
End If
如果TypeName(项目)“AppointmentItem”,则
出口接头
如果结束
我检查了类型,上面写着“AppointmentItem”。。。但我刚刚发现它只适用于邀请来自外部系统的会议。。。必须进一步检查。。。不过还是要谢谢你的建议。