vba - Outlook 附件计数
问题描述
我正在编写一些代码来保存 Outlook 电子邮件,我需要知道附件的数量。要获得附件计数,请使用此代码。当没有附件时,nAttach 为 0,但当有 n 个附件时,我得到 n+1。我尝试使用 nAttach -1 对其进行更正,但随后又出现了问题,或者有时如果我有 1 个附件,它会变为 0。
Dim oMail As Outlook.MailItem
Dim sAttach As String
Dim nAttach As Integer
nAttach = oMail.Attachments.Count
If nAttach > 0 Then nAttach = nAttach - 1
sAttach = CStr(nAttach)
解决方案
附件计数很可能是正确的。请注意,即使 Outlook 未在附件列表中显示嵌入的 HTML 图像,它们也可以是附件。
推荐阅读
- python - 在 Gensim 中添加停用词
- javascript - 我的反应输入类型 == 数字不起作用
- php - PHP函数按需
- python - python 找不到使用 sudo pip3 install 安装的模块
- java - 快速排序算法“StackOverFlowError”
- ruby - 使用 ruby selenium 验证排序数据的角度 ui 网格
- python - Python 3 - 访问数据哪个更快:数据类或字典?
- javascript - 根据变量 (t/f) 显示 div
- reactjs - react+typescript中的无状态函数组件+prop-types接收组件作为prop?
- python - Firefox 更新后 Selenium (Python3) 不会转到目标 URL