Gil
03-12-2016, 06:35 AM
Hello
I am using this code to close my excel file & it works successfully.
Private Sub CommandButton1_Click()
Dim Path As String
Dim FileName1 As String
Dim FileName2 As String
Path = "C:\Users\Andy's\Documents\Risk Assessments\"
FileName1 = Range("M8")
FileName2 = Range("B35")
ActiveWorkbook.SaveAs FileName:=Path & FileName1 & "-" & FileName2 & ".xls", FileFormat:=xlNormal
ActiveWorkbook.Close
End Sub
My problem is that I am left with this instance of excel which I have to close manually, is there a bit of code I can insert to close it.
I am using this code to close my excel file & it works successfully.
Private Sub CommandButton1_Click()
Dim Path As String
Dim FileName1 As String
Dim FileName2 As String
Path = "C:\Users\Andy's\Documents\Risk Assessments\"
FileName1 = Range("M8")
FileName2 = Range("B35")
ActiveWorkbook.SaveAs FileName:=Path & FileName1 & "-" & FileName2 & ".xls", FileFormat:=xlNormal
ActiveWorkbook.Close
End Sub
My problem is that I am left with this instance of excel which I have to close manually, is there a bit of code I can insert to close it.