Using open file dialog to get name and path of file?


Posted by Tim Francis-Wright on June 07, 2000 8:56 AM

I am working with spreadsheet(A) that manipulates another spreadsheet (B). The main macro in A relies on a file name and path for B that the user inputs. What I would like to do is to use something like xlDialogOpenFile for the user to specify the exact file and path.

Is there a way to do this without opening file B?

Posted by Martyn Bowers on June 08, 0100 6:01 AM

Something like this perhaps ??


Hi Tim
Something like this perhaps ??
Sub macro1()
Filter = "Text files (*.txt),*.txt"
Caption = "Please Select a File " & TheUser
SelectedFile = Application.GetOpenFilename(Filter, , Caption)
ActiveSheet.Range("A1").Value = SelectedFile
End Sub

regards
Martyn



Posted by Tim Francis-Wright on June 08, 0100 6:29 AM

Re: Something like this perhaps ??

Thanks! That's exactly what I needed. I knew that dialog existed but couldn't find it (a sort of programming aphasia, I suppose).