I'm tying to get just the file name that get's selected in a dialogue box. I can get the path and the path and the file name but not just the file name.
Here what I have so far:
'Set up the File Dialog.
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
'Allow user to make multiple selections in dialog box.
.AllowMultiSelect = False
'Set the title of the dialog box.
.Title = "Please select a scan model that this can be modeled after."
.Filters.Add "All Files", "*.*"
If .Show = True Then
oldname = fDialog.SelectedItems.item(1)
NewName = "\\Llfsp2\IRISEUC\RTM\2007\RTMSorageFolder\ScanModels\"
retval = 0
Set objFSO = CreateObject("Scripting.FileSystemObject")
retval = objFSO.CopyFile(oldname, NewName, True)
Else
Exit Function
End If
End With
Here what I have so far:
'Set up the File Dialog.
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
'Allow user to make multiple selections in dialog box.
.AllowMultiSelect = False
'Set the title of the dialog box.
.Title = "Please select a scan model that this can be modeled after."
.Filters.Add "All Files", "*.*"
If .Show = True Then
oldname = fDialog.SelectedItems.item(1)
NewName = "\\Llfsp2\IRISEUC\RTM\2007\RTMSorageFolder\ScanModels\"
retval = 0
Set objFSO = CreateObject("Scripting.FileSystemObject")
retval = objFSO.CopyFile(oldname, NewName, True)
Else
Exit Function
End If
End With