Solved

vba to loop throuhg file in many folders

Posted on 2013-06-17
2
455 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
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.

776 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