I am working on some automation that will require specifying an Excel file for read and write.
Is it possible to browse for Excel file using NativeFileBrowser from UI Styler, or is it restricted only to PRT file format? Shall I go for Windows forms instead?
Yes it is possible. You can even add a filter in the file browser to accept only .xls format. The FileSelection class has a SetFileter method.
Thank you, got it.
Is it possible to use this browser to set the name of the new file that does not yet exists? It works if I point to the existing file, but it returns error if file does not exist. What if I need to create a new file? Is it possible?
Unfortunately, it is not possible to set a non-existing name. This is a capability that is sorely needed. Please file an IR with GTAC requesting this to make your vote heard.
A Block Styler Workaround is to use 2 blocks: a FolderBrowser to select the folder and a String to specify the filename. This works if you are always creating a new file, but is a bit ugly if you want to have the possibility of new or existing.
Other alternatives are the .NET System.Windows.Forms.FileDialog class. It contains methods for specifying paths, extensions, existence checking, etc.