I'm having trouble getting this to work. Here is my code. I'm not getting any
error:
Sub copy_contents_of_folder()
sourcepathname = "C:\Documents and
Settings\dmobley\Desktop\JunkFolder\TESTEXCEL"
destpathname = "C:\Documents and Settings\dmobley\My Documents\My Music"
filemask = "*.xls"
fname = Dir(sourcepathname & filemask, vbNormal)
Do While fname < ""
FileCopy sourcepathname & fname, destpathname & fname
fname = Dir()
Loop
End Sub
"colofnature" wrote:
Try this:
Sub copy_contents_of_folder()
sourcepathname = "C:\MyFolder\"
destpathname =
"C:\WINNT\Profiles\MyUserName\Desktop\MyOtherFolde r\"
filemask = "*.xls"
fname = Dir(sourcepathname & filemask, vbNormal)
Do While fname < ""
FileCopy sourcepathname & fname, destpathname & fname
fname = Dir()
Loop
End Sub
Change the values of "sourcepathname" and "destpathname" to the
relevant folders - don't forget the trailing \'s
Hope it helps
Col
--
colofnature
------------------------------------------------------------------------
colofnature's Profile: http://www.excelforum.com/member.php...o&userid=34356
View this thread: http://www.excelforum.com/showthread...hreadid=543080