Billdub417
New Member
- Joined
- Nov 5, 2019
- Messages
- 45
Hello all,
I have the following code, but when this exports to a separate csv file, it comes up with an error message "File format and extension of xxx don't match. The filecould be corrupted or unsafe."
Is there a way to stop this error message coming up, without going in and resaving it as a csv file:
I have the following code, but when this exports to a separate csv file, it comes up with an error message "File format and extension of xxx don't match. The filecould be corrupted or unsafe."
Is there a way to stop this error message coming up, without going in and resaving it as a csv file:
VBA Code:
Dim wbI As Workbook, wbO As Workbook
Dim wsI As Worksheet, wsO As Worksheet
Set wbI = ThisWorkbook
Set wsI = wbI.Sheets("Export")
Set wbO = Workbooks.Add
With wbO
Set wsO = wbO.Sheets("Sheet1")
wsI.Range("A1:aa700").Copy
wsO.Range("A1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End With
Dim IntialName As String
Dim sFileSaveName As Variant
IntialName = "Sample Output"
sFileSaveName = Application.GetSaveAsFilename(InitialFileName:=InitialName, fileFilter:="Excel Files (*.csv), *.csv")