Outlook pop up that says the excel file is opened in message

Hi,

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.

same issue with this article but no solution - File being used by another process error with moving and deleting files - Help - UiPath Community Forum.

Tried - Kill process for both Excel and outlook, but no luck, also tried adding some delay but there’s still a pop up in outlook.

Anyone can assist? :slight_smile:

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:

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

  6. 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.

Thanks for a quick response, however tried some of your solutions(1,2,4) but still no luck. :frowning:

Hii @Ralph_Sena26,
Please check on task manager just before sending mail activity that is any excel instance is open or not if it is then before sending mail kill that instances.

Hi @Ralph_Sena26

In the kill process activity give the Excel name as “EXCEL.EXE”. Check the below image for more clarification. No need to kill the outlook application.
image

Hope it helps!!

Hi Everyone,

I made changes on the retry mechanism and it worked! But I still don’t get why the outlook is saying that the excel is opened even if there’s no excel running on background, even in the task manager.

Work around is to catch the error and click “yes” on the outlook pop up.

counter(int32) = 1
retries(Int32) = 3
error_tag(boolean) = False

Do while:
IF activity: error_tag = true
Then:
use browser/application - indicate the pop up in outlook.
Do:
keyboard shortcuts activity- Enter
Break activity

Try Catch:
Try: Send outlook mail message activity
change the TimeoutMS to 2000 milliseconds(2seconds).

Catch:
counter = counter + 1
error_tag = true

Do while condition:
convert.ToDouble(count) <> convert.Todouble(retries)

Thank you!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.