'How can I close this specific Excel Files when it's open then export with vba code?

Currently I have this code to close workbook:

Sub SaveWorkbook()

    Application.DisplayAlerts = False
    ActiveWorkbook.Save
    ActiveWorkbook.Close

    Application.DisplayAlerts = True
End Sub

However I would like to close specifics workbooks. I need to export 4 excel files from sap and then it opens. Files' names are always the same: "AA", "BB", "C" and "DD".

How can i close this specific excel files when it is open?



Solution 1:[1]

Sub close_workbook()

   Set wb1 = Workbooks("AA")

   Application.DisplayAlerts = False
     wb1.Save
     wb1.Close
   Application.DisplayAlerts = True
End Sub

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Silva