The following code stops at the red line with "Method 'SaveAs' of object '_Workbook' failed. Does anyone know why?
FF="xlCSV". It works fine if I replacewith. Thanks.
FF="xlCSV". It works fine if I replace
Sub SaveIt(FileNm, FF) Dim FSO As Object, a Set FSO = CreateObject("Scripting.FileSystemObject") If FSO.FileExists(FileNm) Then FSO.DeleteFile FileNm If FSO.FileExists(FileNm) Then a = MsgBox(FileNm & " already exists, and cannot be deleted." & vbCr & vbCr & "Contact support on 0xxxxxxxxxx1", _ vbCritical, "ERROR - FILE EXISTS") Exit Sub End If [COLOR="Red"] ActiveWorkbook.SaveAs Filename:=FileNm, FileFormat:=FF[/COLOR] End Sub