Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Conrad Evans   on Nov 14 In MS Office Category.

  
Question Answered By: Ryan Evans   on Nov 14

In the VBA editor's help, try looking for "files collection".
then, select the entry for the
Files Property (Visual Basic for Applications)

It gives you sample code that looks like:
Sub ShowFileList(folderspec)
Dim fs, f, f1, fc, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderspec)
Set fc = f.Files
For Each f1 in fc
s = s & f1.name
s = s & vbCrLf
Next
MsgBox s
End Sub

You can modify this code to do what you need to do for each file.

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Renaming all files in a folder Or get search suggestion and latest updates.


Tagged: