[英]Outlook vba mailItem camelcase
我正在尝试在Outlook 2013中的vba中定义MailItem变量。但是,每次我输入Dim mail AS MailItem时 , MailItem都会更新为mailItem 。 据我了解,这不是正确的类型。 当我尝试MsgBox TypeName(mail)时 ,它显示Nothing 。
我不知道为什么会这样。 任何帮助将不胜感激。 谢谢!
整个代码如下
Private Sub Items_ItemAdd(ByVal newMail As Object)
'On Error Resume Next
On Error GoTo ErrorHandler
Dim mail As Outlook.mailItem
If TypeName(newMail) = TypeName(mail) Then ***<-- I want this if block to execute. But it doesn't!***
Set mail = newMail
SaveAttachments (newMail)
End If
ProgramExit:
Exit Sub
ErrorHandler:
MsgBox Err.Number & " - " & Err.Description
Resume ProgramExit
End Sub
TypeName将显示活动对象的类型名称。 如果从未初始化过(空),您将看到“无”
话虽如此,您什么时候才看到dim语句发生了变化? 在Outlook VBA编辑器中?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.