Solved

vba to loop throuhg file in many folders

Posted on 2013-06-17
2
446 Views
Last Modified: 2013-06-17
Hello ,

There are 10-15 folders in a SharePoint directory.
Each folder has a just one file.
Need: >> Loop through each file of those folders and copy them to the local hard drive at C:\HH\
How to do this best? VBA Powershell ….VBA preferred.
0
Comment
Question by:Rayne
2 Comments
 
LVL 35

Accepted Solution

by:
YZlat earned 500 total points
ID: 39254204
Option Explicit
Dim strFolder, objFSO, objFolder, colSubfolders, strOutput, objFile

strFolder = "your sharepath here"

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set colSubfolders = objFSO.GetFolder(strFolder).SubFolders

For Each objFolder in colSubfolders
	For Each objFile in objFolder.Files
        	objFSO.CopyFile objFile.path, "C:\HH\"
	Next
Next

Open in new window

0
 

Author Comment

by:Rayne
ID: 39254277
Thanks YZLat, you did perfection in just few lines, AWESOME
Thank you
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now