【发布时间】:2016-02-09 22:27:28
【问题描述】:
我有一个在 Excel 2010 中制作的 VBA 脚本,它会在任务到期前 30 分钟向我发送一封电子邮件。消息“strBody”的正文获取三个单元格的值以使消息唯一。它获取任务的名称、任务的注释和任务的截止日期。
我想知道的是,如果引用的单元格之一为空白,是否有办法忽略此消息的一部分。
在下面的这个模板中:
"This email is to notify you that your task : " & Cells(FormulaCell.Row, "A").Value & " with the following note: " & Cells(FormulaCell.Row, "B").Value & " is nearing its Due Date: " & Cells(FormulaCell.Row, "E").Value & "." & vbNewLine & "A wise decision would be to complete this task before it expires!" & _
vbNewLine & vbNewLine & "Truly yours," & vbNewLine & "Task Manager"
如果 Cells(FormulaCell.Row,"B") 为空白,我希望删除以下部分。
" with the following note: " & Cells(FormulaCell.Row, "B").Value & "
这主要是一个清理过程,因为消息中的空白区域远非漂亮,我将其用作 CC 中多人的业务工具。
目前,带有空白注释区域的消息如下所示:
Hello,
This email is to notify you that your task : Give Denise a Promotion, with the following note: is nearing its due date: 02/09/2016.
A wise decision would be to complete the task before it expires!
非常感谢!
【问题讨论】: