Hi All
Long time reader first time poster. I am trying to figure out how to extract the file name for a user selected item via the Application.FileDialog(msoFileDialogFilePicker) method. The below code prompts the user to choose an image but i can't seem to figure out how to extract the file name into a string variable. If i set .SelectedItems(1) equal to a string variable i get an error. Any ideas? Thanks.
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.InitialFileName = CurDir
.Filters.Clear
.Filters.Add Description:="Images", Extensions:="*.jpg", Position:=1
.Title = "Choose image"
If .Show = -1 Then thefile = .SelectedItems(1) Else thefile = 0
End With
Bookmarks