I’m sending an email with an excel attachment, the flow would go like “Save Excel File as” —> “Kill Process” —> “Send Outlook Mail Message”. The error is on send outlook mail activity because of the pop up.
Hi Ralph! If you are facing an issue with the “Send Outlook Mail Message” activity due to a pop-up or if the Excel file is being used by another process, you can try the following approaches to handle the situation:
Retry mechanism: Instead of immediately sending the email after killing the Excel process, you can implement a retry mechanism. After killing the process, introduce a loop with a delay and retry the “Send Outlook Mail Message” activity until it succeeds or until a certain number of attempts have been made.
Close Excel gracefully: Instead of abruptly killing the Excel process, you can try closing it gracefully by using the “Close Workbook” activity or the “Quit” method of the Excel application object. Make sure to close any open workbooks and release the Excel application object properly before proceeding with sending the email.
Ensure proper disposal: Ensure that you have properly disposed of all Excel-related objects and variables. Use the “Dispose” method for any Excel objects, such as workbooks or worksheets, to release any underlying resources they might hold.
Delay before sending email: After closing the Excel application, introduce a short delay before executing the “Send Outlook Mail Message” activity. This delay can give the system some time to release any resources associated with the Excel file.
Check for Excel process termination: Before proceeding with the “Send Outlook Mail Message” activity, you can add a check to verify that the Excel process has indeed terminated. You can use the “Get Processes” activity to retrieve a list of running processes and check if the Excel process is still running. Wait until the Excel process is no longer found before sending the email.
Avoid file locking: Ensure that the Excel file is not locked or in use by any other process. Make sure to close any other applications or processes that might have the file open before attempting to send the email.
Implementing a combination of these techniques can help you handle the situation where the Excel file is being used by another process and resolve the pop-up issue when sending the email with the Excel attachment using the “Send Outlook Mail Message” activity.