VBA: Loop range of file paths and move them to static path

vvSTRIDEvv

Board Regular
Joined
Jun 17, 2010
Messages
74
Hello, I am having an issue moving some pdf files from the network location to a static local path. See image for sheet example.

When I use this seemingly simple code I get a Path/access error, despite having access. I think I'm missing something.

VBA Code:
Sub RectangleRoundedCorners1_Click()
    Dim PDFfile As Range
    For Each PDFfile In ActiveSheet.Range("A1:A300")
        If PDFfile.Value <> "" Then
            FileCopy PDFfile.Value, "C:\Users\JValentine\Documents\Test" & PDFfile.Value
        End If
    Next
End Sub

The paths in column A look like this:
\\grouper\IBML\Images\060523\742200\09761901652.pdf
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Try:
VBA Code:
                FileCopy PDFfile.Value, "C:\Users\JValentine\Documents\Test" & Mid(PDFfile.Value, InStrRev(PDFfile.Value, "\"))
 
Upvote 0

Forum statistics

Threads
1,215,463
Messages
6,124,963
Members
449,200
Latest member
indiansth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top