Refresh Templates in File Path reads error due to spacing/string splits

Hello,

I am currently developing a robot designed to open 22 documents within a file path, run a macro within each connected to an internal database and then save and close each one.

The most substantial step tripping me up is due to spacing within the file path.

The robot begins by taking all the files and copying them into a separate sub folder. After re-assigning the file path to the new directory, the file path is split again to isolate just the file name to perform a type into function to open and run a macro function within each file.

When the excel application opens this message pops up each time and then several more follow that contain the language at the spacing points in the file path:
image
Not only does that happen every time, but it looks like the excel file isn’t opening properly either which leads me to think that my string split might be an issue as well.

The information I have in the start process box is as follows:
FileName: “C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.EXE”
Arguments: “J:\FN\PA\MF Acctg\Oversight\UiPath Refresh Templates\DailyFiles”+split2item_(0).ToString

Any ideas would be great. Have tried tripling the quotes as I have read on some threads. Also have attempted to put the argument in the filename box alone and at the end of the excel application name but neither worked.

Thank you

Hi @ksitomer

Any chance you could package a simple zip project that tries to emulate your steps? It would make it simpler to go over it and try to provide a solution.

Also, what is the way you are running your macros? There is an activity for that within Studio that can be run directly from the Excel Application Scope.

This includes every step up until entering credentials is required which I have omitted as these are internal security features unique to my company. That portion is the opposite side of the parallel in the second ‘for each’ section but hasn’t caused me any issues so it should be okay not including those steps.

UiPathRefresh.xaml (20.4 KB)

Could you explain what the process should do in a simple bullet point list? :slight_smile:

I tried to follow it, but it is a bit difficult without the full context. For now, I think I’ve seen one inconsistency, which is in the first For Each. Basically, it seems like you are trying to copy a file by a modified path to it, which would in my opinion invalidate the path, no?

  • Open all excel templates within a folder (.xltm, .xlsm and .xlsx formats)
  • Run a macro within each file to refresh the data/tables within (various)
  • Save and close each template in a new file path with today’s date added on the end
  • End