We help IT Professionals succeed at work.
Get Started

Need VBA Code to Move MS Office Files to Different Folders and Place PDF Copies in Other Folders

Last Modified: 2016-02-10
Using:  Win 7 and MS Office 2010 Apps

We need to process hundreds of documents with the following general workflow and could use a VBA Script to streamline the process.

Here are the tasks:

User receives a Word 2010 doc via email, let's call it myfile.doc and drags it into Folder A (this Folder could be the designated folder for the script to target).  User may receive several files in the same email, all destined to Folder A.  Also, other users may put files requiring the same processing into Folder A.

Folder A will contain only files which need the automated processing below.

User then (the automation is needed from this point forward), using only myfile.doc as an example, but code would need to cycle through all files in Folder A:

- Moves myfile.doc into Folder B
- Saves myfile.doc as myfile.PDF into Folder C
- Saves myfile.doc as myfile.PDF into Folder D
- Moves myfile.doc from Folder A into Folder E
- Stops when Folder A is empty; leaving user with view of the empty Folder A as confirmation all files were processed

In all cases, the various folders could be on different (mapped) network drives, hence this needs to be coded to use the full filepath (windows environment).

Also, while the above example is written showing .doc files, we can expect .docx as well as Excel files in .xls, .xlsx, and .xlsm.

Thx a bunch.
Watch Question
End-user support
This problem has been solved!
Unlock 1 Answer and 10 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE