VB:Sub openIt() Dim strFile As String strFile = Application.GetOpenFilename Workbooks.Open strFile End Sub
I am making a macro that requires that user to enter a directory path into a input box and the macro will open the file. Right now it works fine bit i would like to change the code so that instead of using an input box it brings up a box that will allow them to browse files on their computer and then select one to open. Does anyone know how i can do this.
You'll find more information on the syntax in help, but post back here if you need further help.
Last edited by Dave Hawley; September 8th, 2006 at 13:04.
Dont forget to check if user doesnt cancel the operation.
In that case this method will return False value.
Something like this
VB:Sub openIt() Dim strFile As String strFile = Application.GetOpenFilename If strFile <> "False" Then Workbooks.Open strFile End Sub
Last edited by Thor; September 8th, 2006 at 05:48.
There are currently 2 users browsing this thread. (0 members and 2 guests)