VBA- URGENT HELP ON UNZIPPING AND RETRIEVING DATA

ConfusedSoul

New Member
Joined
Nov 16, 2016
Messages
6
Hello good men and women!!
Please please help me resolve this urgent requirement!!

1. I have a shared drive with millions of folders ( some zipped, some not), containing different files ( extension as .dat, .csv, .log, .txt)
2. I need to: have an excel created with column headers populated as below for all files ( even those within zipped folders)
3. I have been adviced to copy each file on to my local and not open it from the shared drive ( basically not to blast the server with my incapable vba skills . TINGG :D)

HELP PLEASE???

Col A : File name including path
Col B..... COL whatsoever : First row of each file if it is an excel, csv or txt ( Basically after the headers in each file)
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Sub GetFileName()
Call LoopAllSubFolders("C:\blah\blah\")
End Sub

Sub LoopAllSubFolders(ByVal folderPath As String)

Dim fileName As String
Dim fullFilePath As String
Dim numFolders As Long
Dim folders() As String
Dim DetailWs As Worksheet
Dim i As Long
Dim row As Integer
Dim column As Integer
Application.Workbooks.Add
Set DetailWs = Application.ActiveSheet

If Right(folderPath, 1) <> "\" Then folderPath = folderPath & "\"
fileName = Dir(folderPath & "*.*", vbDirectory)
DetailWs.Cells(1, 1).Value = folderPath
While Len(fileName) <> 0
If Left(fileName, 1) <> "." Then
fullFilePath = folderPath & fileName

If (GetAttr(fullFilePath) And vbDirectory) = vbDirectory Then
ReDim Preserve folders(0 To numFolders) As String
folders(numFolders) = fullFilePath
numFolders = numFolders + 1
Else
'Insert the actions to be performed on each folder
'Step 1: Copy to local
'This example will print the full file path to the newly created workbook
row = row + 1
DetailWs.Cells(row, 1).Value = folderPath & fileName
'Debug.Print folderPath & fileName
End If
End If
fileName = Dir()
Wend

For i = 0 To numFolders - 1
LoopAllSubFolders folders(i)
Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,557
Messages
6,114,293
Members
448,564
Latest member
ED38

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top