Hi vb6
It might depend on what you want to do. Using the method Dr has suggested will open the file when you click open. You could then get the name using
Code:
ActiveWorkbook.Name
in the next line of code.
Another method you could use is 'GetOpenFilename'
eg
Code:
Sub a()
Dim sFile As String
sFile = Application.GetOpenFilename _
("Excel files (*.xls), *.xls", , "Select a File")
MsgBox sFile
End Sub
This doesn't open the file but returns the full path and file name. If you then want to open the file you need to use the open method. There is an example in this thread: thread707-603390
To get just the file name takes a little string manipulation
eg
If a man says something and there are no women there to hear him, is he still wrong?
The faqs ma'am, just the faqs. Get the best from these forums : faq222-2244
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.