06-23-2021 09:41 AM
I'm working on streamlining a process for saving files once the program has been completed and I can't seem to figure out how to automatically fix a SaveAs issue where the file name already exists. If the file name already exists, I just want to add an "_1" at the end and try saving again, increasing the number by 1 each time it fails until it finally has a name that doesn't exist. I tried to grab the error out from the Invoke node however, the saveas dialog box still appears and the loop I made to add the "_#" at the end doesn't start. Any ideas?
Solved! Go to Solution.
06-23-2021 09:44 AM
Hi jwohler,
@jwohler wrote:
Any ideas?
Idea: when you have problems with YOUR code then you should attach YOUR code so we can inspect it and (maybe) provide improvements/suggestions!
06-23-2021 09:48 AM
Well my main issue is just trying to figure out how the Invoke Node works and if there's a way around the Excel SaveAs dialog box. I can't seem to find any documentation on how the various classes/methods work with the Invoke Node.
06-23-2021 10:02 AM
Hi jwohler,
@jwohler wrote:
Well my main issue is just trying to figure out how the Invoke Node works and if there's a way around the Excel SaveAs dialog box.
The Invoke node calls an Excel method - and you can do NOTHING while Excel is busy with executing that method!
When you need to check the filepath than you should do that BEFORE you call Excel to save the data using your filepath…
@jwohler wrote:
I can't seem to find any documentation on how the various classes/methods work with the Invoke Node.
All those Excel methods/properties are explained at MSDN - you "just" need to read the manuals…
06-23-2021 11:30 AM - edited 06-23-2021 11:33 AM
@jwohler wrote:
I can't seem to figure out how to automatically fix a SaveAs issue where the file name already exists. If the file name already exists, I just want to add an "_1" at the end and try saving again, increasing the number by 1 each time it fails until it finally has a name that doesn't exist.
That's exactly what Create File with Incrementing Suffix VI does...
But as everyone else said you will have to do this before invoking your method.