Example - Dir Function

'===============================================================
' Example of using the Dir Function
' This script displays all the files In the specified directory.
' Files will be displayed one at a time inside message boxes.
'===============================================================
Sub Main
    Dim filename As String
    Dim dirname As String
    dirname = InputBox("Please type a directory's pathway (be sure to include the ending backslash):","Directory")
    filename = Dir(dirname & "*.*",0)
    Dim count As Integer
    count = 0
    While filename <> ""         count = count +1         MsgBox count & " - " & filename         filename = Dir ' find the Next file     Wend End Sub