PDA

View Full Version : Solved: FileDialogFilePicker



mferrisi
01-16-2008, 04:13 PM
I am attemping to bring in the filename and location of file that the user selectes from a FileDialog box.

When I use the following code,

Application.FileDialog(msoFileDialogFilePicker).Show
Filename = Application.FileDialog(msoFileDialogFilePicker).InitialFileName

Filename is equal to the name of the first folder.
ie the file selected is w:\YearNum\Inventory\Person\test.xls
but this code returns only w:\YearNum.

What do I need to do to get the entire string?

Thank you,

M

tpoynton
01-16-2008, 04:43 PM
try just this line:

Filename = Application.GetOpenFilename

While I havent used this much, I dont think you need to show it before this line.

xld
01-17-2008, 02:53 AM
With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = False
.Show
If .SelectedItems.Count > 0 Then
MsgBox .SelectedItems(1)
End If
End With

mferrisi
01-17-2008, 06:47 AM
Thank you!