• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA - MOVE PDFs to New Path (indicated in Cell) - Help Please!!!

Alex Link

New Member
I am "new-ish" with Macros... I am working on getting about 300 PDFs renamed and moved into appropriate folders.

I have macros set-up to get the file names, rename the files and create folders, but I can not figure out how to move or copy the files based on the file path that I have indicated for the specific PDF. Everything I find online shows moving files from one folder to another, but I need to move these PDFs from 1 folder into 300 uniquely named folders.

I need something that can tell excel to Move Files (or copy files) , current path (or xDir) I want to set to "C:\" for a prompt to choose a folder and I want to set the file names (from column B) to be SelectedItems and then move or copy to the folder path that I have indicated in Column C.

My spreadsheet is set-up as shown below (current folder path = Desktop)

Column A=Old File Name (ran macro "GetFiles")
- i.e. Reg 123 Survey Reprt October.pdf
Column B=New File Name (ran Macro "RenameFiles"
- i.e. October Survey - Region 123.pdf
Column C = new folder path (each "region" has it's own folder)
- i.e. C:\Reports\October\Region 123
C:\Reports\October\Region 234
C:\Reports\October\Region 467
 
Welcome to the forum!
What is the "old path"?
If:
A2=Reg 123 Survey Reprt October.pdf
B2= October Survey - Region 123.pdf
C3=?
You put C3= 1 or more paths? I guess those are delimited by vbLF?

Which is it, Move or Copy? Obviously, you can only Move/Name a file to one location only. I guess you can copy to one or more folders and then delete the original file to simulate move to multiple folders.
What happens if same file name exists in folder(s) you move/copy to? Overwrite or prompt?

These kinds of things can wind up being a problem. If you delete the file, I recommend making sure that it goes to the recycle bin.
Whatever you test, be sure to backup your files before you trust a macro such as this.
 
Back
Top