I am trying to get this code to work without errors and there is one error I cannot get past.
Sub EXPORT_CSV()
Dim fPath As String
Dim wb0 As Workbook
With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = False
.Show
If .SelectedItems.Count > 0 Then
fPath = .SelectedItems(1) & "\"
Else
Exit Sub
End If
End With
fname = fPath & "my_file.csv"
Worksheets("my_file.csv").Copy
Set wb0 = ActiveWorkbook
wb0.SaveAs fname
wb0.Close
End Sub
So as long as you have a worksheet named "my_file.csv" then the code works great. It's when I go to open the saved worksheet that I get my first error.
The file you are trying to open, 'my_file.csv', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?
And I click yes and the file looks correct; I see the one worksheet with the exact same data on the workbook I saved it from.
Does anyone have any idea what is going on here? Thanks for your help.
Bookmarks