View Single Post
 
Old 07-01-2015, 11:59 PM
saurabhlotankar saurabhlotankar is offline Windows XP Office 2010 32bit
Novice
 
Join Date: May 2015
Posts: 29
saurabhlotankar is on a distinguished road
Default

Hi,

I have tried writing this code with the help of my friend.

Sub copyPNGfiles()

Dim fso As Scripting.FileSystemObject
Dim fldFrom As Scripting.Folder, fldTo As Scripting.Folder
Dim file As Scripting.file
Set fso = New FileSystemObject
Set fldFrom = fso.GetFolder("P:\Report\ABCD_1")
Set fldTo = fso.GetFolder("P:\Report\ABCD_2")
For Each file In fldFrom.Files
If Right(file.Name, 4) = ".png" Then
file.Copy fldTo.Path & "\" & file.Name, True
End If
Next file

End Sub



But problem with this code is it copies all images from source folder to the destination folder. What we need is, we want to copy only those images which are mentioned in column B.

we are not able to link the code with that excel file.

Any help would be highly appreciated.

Thanks
Reply With Quote