Thread: moving files
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
urkec urkec is offline
external usenet poster
 
Posts: 131
Default moving files

"Donna S" wrote:

How do I select all files in a folder and then have it ask me where to move
them too?



You can also use the FileSystemObject object:


Sub test()

Set fso = CreateObject("Scripting.FileSystemObject")

strSource = InputBox("Enter source folder path")
strDest = InputBox("Enter destination folder path")

If Not fso.FolderExists(strSource) Then
MsgBox "Source Folder path is invalid", vbCritical
End If

If Not fso.FolderExists(strDest) Then
MsgBox "Target Folder path is invalid", vbCritical
End If

If Right(strDest, 1) < "\" Then
strDest = strDest & "\"
End If

For Each file In fso.GetFolder(strSource).Files
file.Move strDest
Next

End Sub


Hope this is of some help.

--
urkec