PDA

View Full Version : Send Email (Lotus Notes) Creating Temp File Problem



valendj
01-09-2012, 12:42 PM
Hello,
The code below works for a while (6 Months) sending emails then stops sending excels files and the macro then creates temp files and I was wondering why and how could I resolve this. Am I filling a cache in excel? After awhile the file and subject line changes to a number such as 327.xls. We are using Lotus Notes latest version. . I appreciate any help.


Sub Mail_workbook_1()
'send email file
Dim wb As Workbook
Dim I As Long

Set wb = ActiveWorkbook

If Val(Application.Version) >= 12 Then
If wb.FileFormat = 51 And wb.HasVBProject = True Then
MsgBox "There is VBA code in this xlsx file, there will" & vbNewLine & _
"be no VBA code in the file you send. Save the" & vbNewLine & _
"file first as xlsm and then try the macro again.", vbInformation
Exit Sub
End If
End If

On Error Resume Next
For I = 1 To 3
wb.SendMail "A4_PDI", _
"PDI NCM Report *****DO NOT REPLY TO THIS E-MAIL*****"
If Err.Number = 0 Then Exit For
Next I
On Error GoTo 0
End Sub