![]() |
|
#1
|
||||
|
||||
![]() You can test if the file to be copied exists, like this: Code:
Option Explicit Sub copyfiles() Dim m As Variant Dim FileName As String Dim FileType As String FileType = ".txt" For m = 2 To 4 FileName = Cells(m, 1).Value If Dir("C:\Users\roberto.rodriguezram\Desktop\Source\" & FileName & FileType) <> "" Then FileCopy "C:\Users\roberto.rodriguezram\Desktop\Source\" & FileName & FileType, _ "C:\Users\roberto.rodriguezram\Desktop\Destination\" & FileName & FileType End If Next End Sub |
#2
|
|||
|
|||
![]() Quote:
|
![]() |
Tags |
macro, vba |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Browse, search and copy files from one location to another based on the list given in excel sheet us | nmkhan3010 | Excel Programming | 2 | 09-07-2020 10:27 AM |
![]() |
eduzs | Word VBA | 5 | 06-09-2019 06:20 AM |
VBA Word - Search Within Files Containing A String - Copy Files to New Folder | jc491 | Word VBA | 0 | 01-09-2016 12:00 PM |
How to constantly and automatically copy the contacts from a shared folder to my private folder? | Paulo | Outlook | 0 | 08-16-2015 12:06 PM |
![]() |
bartoch | Outlook | 2 | 08-11-2015 07:05 AM |