View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Copy and paste file name


Sub ListAllFilesInFolder()
'James Cone - San Francisco, USA - Oct. 2006
Dim strPath As String
Dim oFSO As Object
Dim oFile As Object
Dim oFolder As Object
Dim N As Long
N = 1
strPath = "C:\Documents and Settings\user\My Documents\My Pictures" '<<<
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.GetFolder(strPath)
Cells(N, 1).Value = oFolder.Path
N = N + 1
For Each oFile In oFolder.Files
Cells(N, 2).Value = oFile.Name
N = N + 1
Next 'oFile
Set oFSO = Nothing
Set oFile = Nothing
Set oFolder = Nothing
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"sebastico"

wrote in message
....
Hello.
I have a file with 2000 photos (jpg) and I need to copy the name of all
photos at a time and paste into a xls file. How can I do this?
Any help is welcome

Sorry if this question does not belong to this community.
If not could you suggest me where to address my question.

Thanks