【发布时间】:2014-05-08 01:24:35
【问题描述】:
我的代码可以使用 Thunderbird 发送带有附件的电子邮件,效果很好。但是,有时必须手动重新打开 Thunderbird 才能使该代码正常工作(很少)。
如果出现错误,如何关闭 Thunderbird 应用程序,重新打开并再次运行此代码?
Public Function fSendThunderbird()
Dim strCommand As String
Dim strTo as string, strCC As String
Dim strSubject As String
Dim strBody As String
Dim strFilePath As String
strTo = "myemail@.cie.com"
strCC = "myemail@.cie.com"
strSubject = ThisWorkbook.Name & " " & Format(Range("E3").Value, "mmmm yyyy")
strFilePath = Application.ActiveWorkbook.FullName
strBody = "Hello"
strCommand = "C:\Program Files (x86)\Mozilla Thunderbird\thunderbird"
strCommand = strCommand & " -compose " & "to=" & strTo & "," & "cc=" & strCC & "," & _
"subject=" & strSubject & "," & "attachment=" & strFilePath
Call Shell(strCommand, vbNormalFocus)
End Function
【问题讨论】:
标签: vba thunderbird