Hi There,
I created a button to allow user on mouse click save as file on their location but I want to close the workbook after save as.
are there any way to close after save as?
I created a button to allow user on mouse click save as file on their location but I want to close the workbook after save as.
are there any way to close after save as?
Code:
Private Sub Image1_Click()
Dim result As Variant
Dim activebook As Workbook
Application.DisplayAlerts = False
ThisWorkbook.Sheets("OpenOrder").Copy
result = Application.GetSaveAsFilename(FileFilter:="Excel File (*.csv), .csv", Title:="Save Excel")
If result <> 0 Then
ActiveWorkbook.SaveAs Filename:=result, FileFormat:=xlCSV
Application.DisplayAlerts = True
'ActiveWorkbook = "result" & ".csv"
'If Workbook_Name <> False Then
'ActiveWorkbook.SaveAs Filename:=Workbook_Name
ActiveWorkbook.Close savechanges:=False
End If
End Sub
Last edited by a moderator: