Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
asummers
 
Posts: n/a
Default Importing File Structures to Excel


Afternoon Guys.

Wondered if someone could help me.

I have a series of folders in Windows and I would like to import them,
their contents and the contents of any subfolders into an Excel file.
Does anyone know of a way I can do this either within Excel or using
third-party software?

Many thanks,

Andrew Summers :)


--
asummers
------------------------------------------------------------------------
asummers's Profile: http://www.excelforum.com/member.php...o&userid=31807
View this thread: http://www.excelforum.com/showthread...hreadid=515294

  #2   Report Post  
Posted to microsoft.public.excel.misc
Steve Yandl
 
Posts: n/a
Default Importing File Structures to Excel

When you say you want to import contents, I'm assuming you want to bring
file and folder names into your worksheet. Put these two subroutines into a
module and then run the subroutine "DoNewFolder()". It will give you a
folder browse window to select a top level folder and then present you with
a message box asking if you want to include subfolders in the listing. It
will add a new workbook where the information will be placed and you can
choose to save that workbook or not.

Sub DoNewFolder()
Application.ScreenUpdating = False
Workbooks.Add
Dim strPath As String
Dim inclSubs As Boolean

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.BrowseForFolder(0, "Select Folder", 0)
If objFolder Is Nothing Then
Exit Sub
Else
strPath = objFolder.Self.Path
End If

If MsgBox("Include Subfolders?", vbYesNo, "Scope") = vbYes Then
inclSubs = True
Else
inclSubs = False
End If

With Range("A1")
.Formula = "Folder Contents: " & strPath
.Font.Bold = True
.Font.Size = 12
End With

Range("A3").Formula = " "
Range("B3").Formula = "File Name"
Range("C3").Formula = "Date Created"
Range("D3").Formula = "Date Last Modified"
Range("E3").Formula = "Date Last Accesssed"
Range("A3:E3").Font.Bold = True

Range("A2").Select

ListFilesInFolder strPath, inclSubs

Application.ScreenUpdating = True

End Sub

Sub ListFilesInFolder(SourceFolderName As String, AlsoSubfolders As Boolean)
Application.ScreenUpdating = False

Dim R As Long

Set fso = CreateObject("Scripting.FileSystemObject")
Set objStartFolder = fso.GetFolder(SourceFolderName)

R = Range("A65536").End(xlUp).Row + 1

For Each itmFile In objStartFolder.Files
Cells(R, 1).Formula = " "
Cells(R, 2).Formula = itmFile.Name
Cells(R, 3).Formula = itmFile.DateCreated
Cells(R, 4).Formula = itmFile.DateLastModified
Cells(R, 5).Formula = itmFile.DateLastAccessed
R = R + 1
Next itmFile

If AlsoSubfolders Then
For Each itmSub In objStartFolder.Subfolders
R = Range("A65536").End(xlUp).Row + 1
Cells(R, 1).Formula = itmSub.Path
ListFilesInFolder itmSub.Path, True
Next itmSub
End If

Columns("B:E").AutoFit

Set objStartFolder = Nothing
Set fso = Nothing

End Sub



Steve Yandl



"asummers" wrote in
message ...

Afternoon Guys.

Wondered if someone could help me.

I have a series of folders in Windows and I would like to import them,
their contents and the contents of any subfolders into an Excel file.
Does anyone know of a way I can do this either within Excel or using
third-party software?

Many thanks,

Andrew Summers :)


--
asummers
------------------------------------------------------------------------
asummers's Profile:
http://www.excelforum.com/member.php...o&userid=31807
View this thread: http://www.excelforum.com/showthread...hreadid=515294



  #3   Report Post  
Posted to microsoft.public.excel.misc
asummers
 
Posts: n/a
Default Importing File Structures to Excel


Sorry that doesnt meant much to me at all.

Basically when you look at windows explorer it shows the folder
stucture and you need to click on the + sign to see the Sub Folders. I
need an exact copy to be exported into a Excel Speadsheet that can then
be edited.




--
asummers
------------------------------------------------------------------------
asummers's Profile: http://www.excelforum.com/member.php...o&userid=31807
View this thread: http://www.excelforum.com/showthread...hreadid=515294

  #4   Report Post  
Posted to microsoft.public.excel.misc
Steve Yandl
 
Posts: n/a
Default Importing File Structures to Excel

Did you select the actual top level folder you wanted to document and then
click OK on that window? It would have listed all the files in the top
folders, the the subfolders with the files inside them, then subs of subs
with their files etc. From your question, that is what I thought you
wanted.

Steve Yandl


"asummers" wrote in
message ...

Sorry that doesnt meant much to me at all.

Basically when you look at windows explorer it shows the folder
stucture and you need to click on the + sign to see the Sub Folders. I
need an exact copy to be exported into a Excel Speadsheet that can then
be edited.




--
asummers
------------------------------------------------------------------------
asummers's Profile:
http://www.excelforum.com/member.php...o&userid=31807
View this thread: http://www.excelforum.com/showthread...hreadid=515294



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel file lost Vivek Excel Discussion (Misc queries) 4 January 5th 06 05:08 AM
Excel crashes while opening excel file imbeddied with macros ct2147 Excel Discussion (Misc queries) 0 December 30th 05 09:05 PM
Pasword protected Excel file encrypted, how do I read this file? jonesteam Excel Discussion (Misc queries) 2 December 12th 05 06:32 PM
TRYING TO SET UP EXCEL SPREADSHEET ON MY COMPUTER MEGTOM New Users to Excel 5 October 27th 05 03:06 AM
importing another file format into Excel Leesa Excel Discussion (Misc queries) 1 May 13th 05 03:43 AM


All times are GMT +1. The time now is 11:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"