Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a column with a path for every record in Column D. Example
\\TEST\MyDoc\Pic.bmp How do I by record copy each file at the path listed to a new folder in My Docs called (CopyData)? Thanks, AJ |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Something like this will work:
Sub test() Dim i As Long Dim arr 'looping through an array is a bit faster arr = Range(Cells(4), Cells(100, 4)) For i = 1 To UBound(arr) 'this presumes the full path is in range in column D FileCopy arr(i, 1), "C:\My Documents\CopyData\" & FileFromPath(arr(i, 1)) Next i End Sub Function FileFromPath(ByVal strFullPath As String, _ Optional bExtensionOff As Boolean) As String On Error GoTo ERROROUT FileFromPath = Right$(strFullPath, _ Len(strFullPath) - _ InStrRev(strFullPath, "\", , vbBinaryCompare)) If bExtensionOff Then FileFromPath = Left$(FileFromPath, _ InStr(1, FileFromPath, ".", vbBinaryCompare) - 1) End If Exit Function ERROROUT: 'or return the provided strFullPath FileFromPath = vbNullString End Function RBS "Aaron" wrote in message ... I have a column with a path for every record in Column D. Example \\TEST\MyDoc\Pic.bmp How do I by record copy each file at the path listed to a new folder in My Docs called (CopyData)? Thanks, AJ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Moving files | Excel Programming | |||
moving files | Excel Programming | |||
Moving files which are linked | Excel Discussion (Misc queries) | |||
Moving files | Excel Programming | |||
Moving Files | Excel Programming |