This is exactly what you want. It will allow you to choose a file and read it into an array in memory. Then optionall clear the array contents. The array is accessible from any procedure in your form for other use.
VB Code:
  1. Option Explicit
  2. 'Add a CommonDialog Control to your toolbox and add to your form.
  3. 'Project > Components > Controls tab > select "MS Common Dialog Control" > click OK.
  4. Private arArray() As String
  5.  
  6. Private Sub Command1_Click()
  7.  
  8.     On Error GoTo My_Error
  9.    
  10.     Dim strFilePath As String
  11.     Dim strBuff As String
  12.    
  13.     With CommonDialog1
  14.         .CancelError = True
  15.         .DialogTitle = "Select a file"
  16.         .InitDir = App.Path
  17.         .ShowOpen
  18.         strFilePath = .FileTitle
  19.     End With
  20.    
  21.     Open strFilePath For Input As #1
  22.       strBuff = Input(LOF(1), 1)
  23.     Close #1
  24.    
  25.     arArray() = Split(strBuff, vbNewLine)
  26.     'File contents remail in the array in memory until erased
  27.     If MsgBox("Do you want to clear the array contents?", vbYesNo + vbQuestion) = vbYes Then
  28.         Erase arArray
  29.     End If
  30.     Exit Sub
  31.    
  32. My_Error:
  33.     If Err.Number = cdlCancel Then
  34.         MsgBox "File Open Canceled", vbOKOnly + vbExclamation
  35.     Else
  36.         MsgBox Err.Number & " - " & Err.Description, vbOKOnly + vbExclamation
  37.     End If
  38. End Sub