Vba: copy a file from a directory to another directory

Nelson78

Well-known Member
Joined
Sep 11, 2017
Messages
526
Office Version
  1. 2007
Hello everybody.

I have a file, suppose

paper.pdf

laying in

c:\Users\john.smith\Desktop\Folder1

I have to copy it and save in

c:\Users\john.smith\Documents


How can I figure it out?

Thank's.
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Have you ever used the drag and drop feature in File Explorer? You can move files from one directory to another simply by selecting and dragging to the desired folder and releasing the mouse button. Here is a link that explains it.

How to Copy or Move Files and Folders on Windows 10 (howtogeek.com)

Unless you have a recurring need to use code to do the job, this method is fast and can move multiple files at a time.
 
Upvote 0
Sub t()
FileCopy "C:\Users\john.smith\desktop\Folder1\paper.pdf", "C:\Users\john.smith\Documents\paper.pdf"
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,214,789
Messages
6,121,593
Members
449,038
Latest member
Arbind kumar

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