Ok, here is my code. Thanks.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
On Error GoTo errHandler:
Range("c9").Activate
filesavename = Application.GetSaveAsFilename(Sheet1.Range("C10") &
Sheet1.Range("C7"), _
fileFilter:="Microsoft Excel Workbook (*.xls), *.xls")
If filesavename <> False Then
Application.DisplayAlerts = False
Dim resp As Long
resp = vbYes
If Dir(filesavename) <> "" Then
resp = MsgBox(Prompt:=filesavename & " already exist, overwrite?",
Buttons:=vbYesNo)
End If
If resp = vbYes Then
Application.ScreenUpdating = False
Application.EnableEvents = False
ActiveWorkbook.SaveAs filesavename
Dim myXLS, mypath
Dim myCSV As String
myXLS = ActiveWorkbook.Name
myCSV = Replace(myXLS, ".xls", ".csv")
mypath = ActiveWorkbook.Path
Sheets("Basic").Select
ActiveSheet.Copy
ActiveWorkbook.SaveAs filename:= _
mypath & "\" & myCSV _
, FileFormat:=xlCSV, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.Close
MsgBox (myCSV & " have been created and saved in the same directory
with " & myXLS)
Sheets("Advance").Select
Application.EnableEvents = True
Application.DisplayAlerts = True
End If
Else
Cancel = True
End If
Cancel = True
errHandler:
Application.EnableEvents = True
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub