' Demo: this script lists all files (meeting a given mask eg *.spo) located in a given folder ' rlevesque@videotron.ca 2001/09/12 ' http://pages.infinit.net/rlevesqu/index.htm Option Explicit Sub Main Dim strPath As String Dim strFilemask As String strPath="c:\\program files\\spss\\" strFileMask="*.sav" 'First example Call GetListOfFiles(strPath, strFileMask) 'Second example Call GetListOfFiles("c:\\program files\\spss\\","g*.sav") ' Call GetListOfFiles("", "") End Sub Sub GetListOfFiles (strPath As String, strFileMask As String) Dim strFname As String Dim strHeading As String 'Heading of MsgBox If InStr(strPath, "\\") = 0 Then 'no path given, use current folder strPath = objSpssApp.GetSPSSPath End If If Len(strFileMask) = 0 Then 'no file Mask given, show all files strFileMask = "*.*" End If strHeading = "List of " & strFileMask & " files in " & vbCr & StrPath 'Get the first file name strFname = Dir$(strPath & strFileMask) While strFname <> "" If MsgBox (strFname,vbOkCancel,strHeading) = vbOK Then 'Get the next file name strFname = Dir$() Else 'exit strFname = "" End If Wend End Sub