Web Development

General discussion


vbXL - copying from multiple w/books

By JonathanSwift ·
I need to copy line 2 from every spreadsheet in a directory. I have control of the spreadsheet design but no control of its name nor do I know how many spreadsheets there will be in the directory. I have the copying routine down but need the for..next concept

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

vbXL - copying from multiple w/books

by jscragg In reply to vbXL - copying from mult ...

Private Sub EnumerateFolder(strFolderPath)
Dim objFSO As Scripting.FileSystemObject
Dim objFolder As Scripting.Folder
Dim objFiles As Scripting.Files
Dim objFile As Scripting.File

Set objFSO = New Scripting.FileSystemObject
Set objFolder = objFSO.GetFolder(strFolderPath)
Set objFiles = objFolder.Files

For Each objFile In objFiles
' This will enumerate the collection of files
' found in the specified folder.
' Do your work here.
Next objFile
End Sub

Related Discussions

Related Forums