Make your own free website on Tripod.com
      Option Explicit
      
      Private Type OpenFileName
      lStructSize As Long
      hwndOwner As Long
      hInstance As Long
      lpstrFilter As String
      lpstrCustomFilter As String
      nMaxCustFilter As Long
      nFilterIndex As Long
      lpstrFile As String
      nMaxFile As Long
      lpstrFileTitle As String
      nMaxFileTitle As Long
      lpstrInitialDir As String
      lpstrTitle As String
      flags As Long
      nFileOffset As Integer
      nFileExtension As Integer
      lpstrDefExt As String
      lCustData As Long
      lpfnHook As Long
      lpTemplateName As String
      End Type
      
      Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias _
      "GetOpenFileNameA" (pOpenfilename As OpenFileName) As Long

      Function GetOpenFname(fName As String) As Boolean
      Dim ofn As OpenFileName
      ofn.lStructSize = Len(ofn)
      ofn.lpstrFilter = "Comma Separated Values (*.csv)" + Chr$(0) + "*.csv" + Chr$(0) _
      + "Text Files (*.txt)" + Chr$(0) + "*.txt" + Chr$(0) _
      + "All Files (*.*)" + Chr$(0) + "*.*" + Chr$(0)
      ofn.lpstrFile = Space$(254)
      ofn.nMaxFile = 255
      ofn.lpstrFileTitle = Space$(254)
      ofn.nMaxFileTitle = 255
      ofn.lpstrInitialDir = CurDir
      ofn.lpstrTitle = "Coordinate Data in CSV Format"
      ofn.flags = 0
      Dim lngRetVal As Long
      lngRetVal = GetOpenFileName(ofn)
      
      If (lngRetVal) Then
      GetOpenFname = True
      fName = Trim$(ofn.lpstrFile)
      Else
      GetOpenFname = False
      
      End If
      End Function