How do I use File Dialog Boxes in Excel through VBA? I have a command button on a worksheet that, when clicked, I want to display a File Open dialog box, get the filename and load the (Excel) file. How can I do this?
As an addition to this question, now that I have returned a filename, using Application.GetOpenFilename, how can I split this string up into the Path and FileName?
1. the path will be the Current Directory so you can use Filesystem.CurDir (this may change later in your program so set a variable to this value straight after the GetOpenFilename)
2. to get the filename just take the right of the entire string as shown below.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.