#1
|
|||
|
|||
Copy images from one folder to another
Hi Guys,
I have one excel sheet in which i have names of images saved on my local drive. I want to copy and paste images mentioned in column B from one folder to another folder. Just for example i have give source and destination folder names (Path) also in attached excel sheet. I want to know is it possible through VBA macro. Thanks, Saurabh |
#2
|
|||
|
|||
Sorry guys..Here is the excel file.
Numbers mentioned in column B are image file names. .png or .jpeg format |
#4
|
|||
|
|||
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 |
#5
|
|||
|
|||
It's simpler than that, this was the part of the linked to page meant for you to see
Code:
Dim SourceFile, DestinationFile As String SourceFile = "SRCFILE" ' Define source file name. DestinationFile = "DESTFILE" ' Define target file name. FileCopy(SourceFile, DestinationFile) ' Copy source to target. your DestinationFile would be your C cell & "\" & your B cell you need the above inside a For-Each-Next loop of the data rows of your sheet. |
#6
|
|||
|
|||
Not able to do it.
|
#7
|
|||
|
|||
Show us what you tried.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
copy from web and paste in a word document : no images are shown | Ron Wolpa | Word | 5 | 09-11-2013 02:16 AM |
Copy formatting setting between images on the slide | pogonoforysci1 | PowerPoint | 11 | 08-10-2012 03:54 AM |
Loop through folder of workbooks and copy range to other workbook | Snvlsfoal | Excel Programming | 3 | 07-29-2011 05:55 AM |
copy-pasting hyperlinked images: work only at the edges | Xuanzang | PowerPoint | 0 | 12-07-2010 02:35 AM |
Copy email to another folder | loc | Outlook | 0 | 12-26-2006 07:39 AM |