Home PDF Splitter Phantom Mouse Get File Names Proxy Web Requests Google Traffic Gmail Price Alerts Trading Bot What's My Public IP HEX-ASCII Converter Stableford Calculator CV Golf Ball Tracer QR Code Generator About Me

Python

VBA

Get File Names

Another simple one written in Python. It creates a .txt file with a list of the file names of everything in the directory it's run.

import os FileListArray = os.listdir() print(FileListArray) ListLength = len(FileListArray) FileList = open("FileList.txt","w+") for x in FileListArray: print(x) FileList.write(x + "\n") FileList.close()


Or alternatively, you can do it in Excel with VBA. Just add a button to run this code:

Private Sub CommandButton1_Click() Dim FileName As String, FileList() As String, lCount As Long, i As Variant, NumberOfFiles As Variant lCount = 0 FileName = Dir(ActiveWorkbook.Path & "\*") While Len(FileName) > 1 lCount = lCount + 1 ReDim Preserve FileList(1 To lCount) FileList(lCount) = FileName FileName = Dir() Wend ActiveSheet.Range("A1").Select For i = LBound(FileList, 1) To UBound(FileList, 1) ActiveSheet.Cells(0 + i, 1).Value = FileList(i) 'MsgBox FileList(i) Next i End End Sub