Thread: moving files
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Vergel Adriano Vergel Adriano is offline
external usenet poster
 
Posts: 857
Default moving files

Donna,

Here's one way:

Sub test()
Dim strSource As String
Dim strDest As String
Dim strFileName As String

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

strFileName = Dir(strSource, vbDirectory)
If strFileName = "" Then
MsgBox "Source Folder path is invalid", vbCritical
Exit Sub
End If

strFileName = Dir(strDest, vbDirectory)
If strFileName = "" Then
MsgBox "Destination Folder path is invalid", vbCritical
Exit Sub
End If

strFileName = Dir(strSource & "\*.*")
While strFileName < ""
Name strSource & "\" & strFileName As strDest & "\" & strFileName
strFileName = Dir
Wend

End Sub

--
Hope that helps.

Vergel Adriano


"Donna S" wrote:

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