Macro complete then move file


#1

Hi,

I have this Macro to run but the time it runs may vary. After it finishes running, I will move the files.

I added delay between Macro and Move file - however, I will have to guess the delay time. Is there a way that uipath move file after the Macro is completed instead of relying on the delay time?


#2

Hi.

This is just one thought I had, but if the file is in use, then it won’t let you move the file. So if the macro is using the file then you might be able to just do a Retry Scope around it, assuming the macro closes the file when it is done.

Other than that, it seems like you need some kind of trigger that that macro is done like a file that exists or something like that.


#3

Another suggestion…
You can maybe have a text file where the macro can update the status on completion.
Something like when the macro starts running, it clears the content of the text file. Once it completes execution, it updates the text file to Completed
You can design a workflow to keep reading the text file and keep looking for Completed status. Once achieved you can trigger your workflow.


#4

Hi @lavint,
The macro you have , contains any arguments ? Or will it ask for any filename to upload or any such pop-up? Or does it sends any pop-up message on success?


#5

Hi @ClaytonM,

Thanks for your response! You are totally right. The error that was thrown and didn’t let me move the file because the Macro was still running. The Macro actually took many XLSXs -> do something -> create many CSVs respectively. Then Uipath will move all the XLSXs to FolderA and move all CSVs to FolderB respectively. Retry scope is a good idea- I will test it out. Thanks!

Lavina


#6

Hi @kaderms,

Thanks for your response! How to have uipath keep reading the text file while running the Macro? Some sort of parallel activities?? I am just not sure which activity to use. Thanks!

Lavina


#7

Hi @SantoshPothina,

Thanks for your response!

The Macro actually took many XLSXs -> do something -> create many CSVs respectively. Then Uipath will move all the XLSXs to FolderA and move all CSVs to FolderB respectively.

However, the Macro may take a long time (depending on how many files to do something and convert to CSVs). So uiPath throws an error because it can’t move the files.

Thank you!

Lavina


#8

@lavint I just noticed that the workflow execution in UiPath continues only after the macro execution is complete. So in that case do you really have the issue of UiPath running ahead of the macro?

This should be happening by default.

I havent tried running macros using UiPath. But I have used macros on excel itself. So I guess I had a little misunderstanding here.


#9

Hi @kaderms,

Yes, there are many Xlsx. The Macro was still doing the for loop to convert Xlsx to Csv when the delay time was up, so it tries to move the files. I can perhaps add an activities in between, like creating a txt file at the end of the Macro like you said. And use the retry scope to trigger the move file action when that txt exists! yup I will test it when I have a moment. Thanks!!

Lavina