I am trying to output a copy of a workbook as a CSV File. I have the code below but on saving it comes up in file type as Excel workbook.
Sub SAVE_CSV() Dim FileName As String FileName = "CSV Import File" Dim fPth As Object Set fPth = Application.FileDialog(msoFileDialogSaveAs) With fPth .InitialFileName = FileName .Title = "Save Your Import File" .InitialView = msoFileDialogViewList If .Show <> 0 Then ThisWorkbook.SaveAs FileName:=.SelectedItems(1) & "*.csv", FileFormat:=xlCSV End If End With
*in*.csv? Also make sure the fileName is an acceptable one, and.SelectedItems(1)doesn't have illegal characters..SaveAsline, addDebug.Print .SelectedItems(1) & ".csv". Is the output a legitimate path and file name?