You can open any excel file using code like this:
But what will happen if we have these 2 lines of code:
Will first open “filePathONE” in a new excel instance, then will open the “filePathTwo” in the same excel instance.
What we can do if we want to open each file in a separate new excel instance?
We must write it like that:
It’s very simple, isn’t it?
But we can face a small problem with this way:
If you want to open an excel file that contains space in its name, for example “my Sheet.xls”, it will give you a runtime error that it can’t open files “my.xls” and “Sheet.xls”.
So what can I do?
Just add “ before and after the file path, just like that:
Like that it will open normally without any errors.
You will need to do the same for any office application (word, powerpoint, ….).