I'm trying to teach myself VBA during the short holiday break. For my first module, I want to create a module that does the following:
Anyway, for number1, I search and found two methods in examples online: Application.FileDialog and GetOpenFilename. Hm, I was wondering, what is the difference between the two (limitation, capabilities, speed, etc.) Is there a significant advantage of one method over another?
Thanks.
Application.FileDialog
is an object. GetOpenFilename
is a property. If you call GetOpenFilename
, Excel owns the dialog object, configures it, displays it, and gives you the return value. If you use Application.FileDialog
, you configure it, display it, and get the return value from the object. Outside of that, they're exactly the same - it's just a matter of who owns and controls the underlying FileDialog
.