KilianD
02-19-2013, 01:37 AM
Hello,
I have this fine macro that, when triggered by a rule, saves attachment and calls the excel macro to process the saved file. The rule also marks the email as read and moves it to the bin. It works fine when single email is received or when I run the rule manually. However, when I receive bunch of emails in the morning, the rule fires, marks the email as read, moves it to the bin and then gives me message "Rule failed" without further details.
This is the code:
Public Sub saveAttachtoDisk(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
saveFolder = "C:\Users\E9752888\Desktop\"
For Each objAtt In itm.Attachments
objAtt.SaveAsFile saveFolder & "\" & objAtt.DisplayName
Set objAtt = Nothing
Next
CallExcelMacro
End Sub
Sub CallExcelMacro()
Dim eApp As Excel.Application
Set eApp = GetObject(, "Excel.Application")
eApp.run "PERSONAL.XLSB!ANDULA_BDCPO"
Response = MsgBox("CSV ready for upload", 0)
End Sub
Any suggestion will be greatly appreciated.
I have this fine macro that, when triggered by a rule, saves attachment and calls the excel macro to process the saved file. The rule also marks the email as read and moves it to the bin. It works fine when single email is received or when I run the rule manually. However, when I receive bunch of emails in the morning, the rule fires, marks the email as read, moves it to the bin and then gives me message "Rule failed" without further details.
This is the code:
Public Sub saveAttachtoDisk(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
saveFolder = "C:\Users\E9752888\Desktop\"
For Each objAtt In itm.Attachments
objAtt.SaveAsFile saveFolder & "\" & objAtt.DisplayName
Set objAtt = Nothing
Next
CallExcelMacro
End Sub
Sub CallExcelMacro()
Dim eApp As Excel.Application
Set eApp = GetObject(, "Excel.Application")
eApp.run "PERSONAL.XLSB!ANDULA_BDCPO"
Response = MsgBox("CSV ready for upload", 0)
End Sub
Any suggestion will be greatly appreciated.