![]() In situations like this, it’s better to ask the user up front which file paths he wants to get, then run your macro and open the files when you actually need to access them. You don’t want your user to wait a full minute before being prompted to select the files he wants to process. You may have a macro that takes a couple minutes to run, but the first minute is spent doing some preprocessing. Let’s say you wanted to grab tab-delimited source files that you’ll parse later and insert into a spreadsheet. You might be wondering why you would want to get a file path but not open the file. This will make more sense when you look at these examples. It’s worth noting that, rather than a boolean, GetOpenFilename will return a string equal to “False” if your data type is a String instead of a Variant. The method returns a boolean of “False” if no file is selected or the dialog is canceled, and returns either a string or an array of strings if file(s) is/are selected. VBA GetOpenFilename allows you to select a file from a file explorer window without actually opening the file. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |