You can create the ftp instruction file by using I/O commands.
Sub MakeFTP()
Dim intUnit As Integer
Dim lngRow As Long
Dim strFileName As String
strFileName = "C:\ftp.txt"
intUnit = FreeFile
Open strFileName For Output As intUnit
lngRow = 2
Do While Len(Cells(lngRow, 1).Value) > 0
Print #intUnit, Cells(lngRow, 4).Value
Print #intUnit, "0"
Print #intUnit, "0"
Print #intUnit, "0"
Print #intUnit, "?"
Print #intUnit, Cells(lngRow, 5).Value
lngRow = lngRow + 1
Loop
Close intUnit
End Sub
Excel will not automaticaly create a detailed list of information about a directory. You can however use VBA to do it for you.
This very simple routine will list all .xls files in a given folder.
Sub DirInfo()
Dim lngRow As Long
Dim strPath As String
Dim strFile As String
lngRow = 1
strPath = "C:\temp\"
strFile = Dir(strPath & "*.xls")
Do While Len(strFile) > 0
Cells(lngRow, 1) = strFile
lngRow = lngRow + 1
strFile = Dir
Loop
End Sub
If you really do require more information about a file you can use the FileSystemObject to search for files.
Sub DirInfoFull()
'
' Requires reference to Microsoft Scripting Runtime
' C:\WINDOWS\SYSTEM32\scrrun.dll
'
Dim fsoTemp As New FileSystemObject
Dim fsoFiles As Files
Dim fsoFile As File
Dim lngRow As Long
Set fsoTemp = New FileSystemObject
Set fsoFiles = fsoTemp.GetFolder("C:\temp").Files
lngRow = 1
For Each fsoFile In fsoFiles
Cells(lngRow, 2) = fsoFile.Name
Cells(lngRow, 3) = fsoFile.Size
Cells(lngRow, 4) = fsoFile.DateLastModified
lngRow = lngRow + 1
Next
End Sub
Bookmarks