在MS Outlook VBA中,为什么在调用MailItem.Move时会出现类型不匹配的错误?

huangapple go评论52阅读模式
英文:

In MS Outlook VBA, why a type mismatch on this call to MailItem.Move?

问题

MailItem.Move 方法的语法如下:

<MailItem>.Move(<Folder>)

下面的显示图像展示了我正在运行的代码、两个监视以及它们提供的错误信息:

在MS Outlook VBA中,为什么在调用MailItem.Move时会出现类型不匹配的错误?

当错误发生并且我点击“调试”时,代码会在以下行上以黄色突出显示:

oMailItem.Move (oDestFolder)

监视显示oMailItem 是正确的类型 MailItem,而 oDestFolder 是正确的类型 Folder。监视窗口还显示了这些对象的名称,表示它们存在。

那么,为什么会出现类型不匹配的问题?

英文:

The method MailItem.Move has the syntax:

&lt;MailItem&gt;.Move(&lt;Folder&gt;)

The following display image shows the code I'm running, two watches, and the error they give:

在MS Outlook VBA中,为什么在调用MailItem.Move时会出现类型不匹配的错误?

When the error occurs and I click "Debug", the code comes up with yellow highlighting on the line:

oMailItem.Move (oDestFolder)

The watches show that oMailItem is of the correct type MailItem and oDestFolder is of the correct type Folder. The watch window also shows the names of those objects, indicating that they exist.

So, why the type mismatch?

答案1

得分: 1

尝试去掉 ()

oMailItem.Move oDestFolder
英文:

Try to get rid of ():

oMailItem.Move oDestFolder

huangapple
  • 本文由 发表于 2023年6月19日 09:46:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/76503184.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定