I have some code that is supposed to save the active workbook as a comma separated text file. The code seemed to work fine until I went under vba project properties and made my code protected so other users could not view it then it quit working. Is there something here that is bad coding practice?
[VBA]Sub csv_save()
YesNo = MsgBox("Do you wish to Save as a CSV File?", vbYesNo + vbCritical, "Caution")
Select Case YesNo
Case vbYes
filesavename = Application.GetSaveAsFilename( _
fileFilter:="Text Files (*.csv), *.csv")
If filesavename <> False Then
MsgBox "Save as " & filesavename
ActiveWorkbook.SaveAs Filename:=filesavename, FileFormat:=xlCSVMSDOS, Password:="", _
writerespassword:="", ReadOnlyRecommended:=False, CreateBackup:=False
End If
Case vbNo
End Select
'This will immediately close workbook without prompting to save
'ActiveWorkbook.Close savechanges:=False
End Sub
[/VBA]