Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy user selected files to new folder.
I know I'm missing a critical piece but can't figure it out. How do I get
just the name of the file they selected (without path)? Sub CopyFilesMacro() Application.ScreenUpdating = False Sheets("Input").Select MyPath = Range("B2").Value MsgBox ("As soon as you click the OK button, a Browse Dialog box will " _ & "pop up. Use it to choose the files you want to copy to the location shown " _ & "in cell B2 of the Input sheet.") Dim fd As FileDialog Set fd = Application.FileDialog(msoFileDialogFilePicker) Dim vrtSelectedItem As Variant With fd If .Show = -1 Then For Each vrtSelectedItem In .SelectedItems FileCopy vrtSelectedItem, MyPath & "\" & vrtSelectedItem.Name & ".xls" Next vrtSelectedItem Else End If End With Set fd = Nothing End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
User selection of folder and open all .xls files within folder | Excel Programming | |||
"Folder Select" Dialogue - Opening multiple files from selected folder | Excel Programming | |||
How to copy 30 csv files from a folder to another folder | Excel Programming | |||
getting filenames from a user selected folder | Excel Programming | |||
User name & password access to Excel files in a folder | Excel Programming |