|
-
Sep 6th, 2000, 10:34 AM
#1
Thread Starter
Addicted Member
Here's what I have. I want to look in the folder D:\Credit\newFolder for a number of files all with the same file extension. I want to know how to open this pariticular folder(D:\Credit\newFolder) to look for the file extensions .JPG.
<code>
'Taken from Crispin
Option Explicit
Dim fs As New FileSystemObject
Dim folCurrent
Dim ColFiles
Dim VarCurrentFile
Private Sub doJpg()
'can I add in here a open statement for a folder????
Set folCurrent = fs.GetFolder(Text1.Text)
Set ColFiles = folCurrent.Files
fs.CreateFolder (folCurrent & "\NEWDIR")
For Each VarCurrentFile In ColFiles
If UCase(Right$(VarCurrentFile, 3)) = "JPG" Then
'process the filenames one by one
Debug.Print VarCurrentFile
fs.CopyFile VarCurrentFile, folCurrent & "\NEWDIR", True
end if
Next
End Sub
</code>
Thanks a lot for all your help
JK
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|