title: Preset the "save as type" field while using Application.FileDialog(msoFileDialogSaveAs) with MSAccess
body: <p>I searched all over for a way to do this.</p>
  
  <p>I want to open a Save As dialog box so the user can choose the location to save a file. But, <strong>I want the "Save as type" field to be preset with "comma seperated value File (*.csv)"</strong></p>
  
  <p>The problem is the "Filter" methode does not seem to work with "msoFileDialogSaveAs". Is it possible to preset the file type using "Application.FileDialog(msoFileDialogSaveAs)"?</p>
  
  <p>At the moment, if I save the file with the .csv extension and then open it in excel, I get the "<em>The file you are trying to open xxx.csv is in a different format than specified by the file extension ...</em>" message. The file works correctly though.</p>
  
  <pre><code> With Application.FileDialog(msoFileDialogSaveAs)
          .Title = "xxx"
          .AllowMultiSelect = False
          .InitialFileName = "xxx.csv"
          '.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"
          result = .Show
          If (result &lt;&gt; 0) Then
              ' create file
              FileName = Trim(.SelectedItems.Item(1))
              fnum = FreeFile
              Open FileName For Output As fnum
  
  
              ' Write the csv data from form record set
              For Each fld In rs.Fields
                 str = str &amp; fld.Name &amp; ", "
              Next
  
             ' Write header line
             str = Left(str, Len(str) - 2)   ' remove last semi colon and space
             Print #fnum, str
             str = ""
  
            ' Write each row of data
             rs.MoveFirst
            Do While Not rs.EOF             
              For i = 0 To 40
                  str = str &amp; rs(i) &amp; ", "    ' write each field seperated by a semi colon
              Next i
              str = Left(str, Len(str) - 2)   ' remove last semi colon and space
              Print #fnum, str
              str = ""
              rs.MoveNext
             Loop
  
          ' close file
          Close #fnum
          End If
    End With
  </code></pre>
  
  <p>Than You!</p>