问题描述
所以这段代码非常适合我。它根据我的 If Len 语句发送电子邮件。在电子邮件正文中,它列出了哪些工作表提示了电子邮件,因为它们会不断变化。我还希望在电子邮件的主题行中列出这些工作表,但不知道如何操作。
Sub Main()
Dim sh As Worksheet,i As Long,shtsRotations As String
Dim shtsFunctions As String,shtsOK As String
For Each sh In ActiveWorkbook.Worksheets
If Application.CountIf(sh.Range("L3:L70"),"<1") > 0 Then
shtsRotations = shtsRotations & vbLf & sh.Name
Else
shtsOK = shtsOK & vbLf & sh.Name & " (Rotations)"
End If
If Application.CountIf(sh.Range("M3:M70"),"<1") > 0 Then
shtsFunctions = shtsFunctions & vbLf & sh.Name
Else
shtsOK = shtsOK & vbLf & sh.Name & " (Functions)"
End If
Next sh
If Len(shtsRotations) > 0 Then
SendReminderMail "test@test.com","Equipment rotations are due!" & shtsRotations,_
"Hello Team," & vbNewLine & vbNewLine & _
"Check customer sheets: " & shtsRotations & vbLf & vbNewLine & _
"In the attatched workbook,you will see which equipment needs to be rotated by the red dates of their last rotation."
End If
If Len(shtsFunctions) > 0 Then
SendReminderMail "test@test.com","Equipment functions are due! "," & vbNewLine & vbNewLine & _
"Check customer sheets: " & shtsFunctions & vbLf & vbNewLine & _
"In the attatched workbook,you will see which equipment needs to be functioned by the red dates,indicating their last function."
End If
If Len(shtsOK) > 0 Then
MsgBox "These sheets are OK: " & vbLf & shtsOK,vbinformation
End If
End Sub
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)