This code goes in the Thisworkbook object.

Uses the contents of A1 and B1 on sheet with a code name of Sheet1.
You may want to control the path as well as the filename

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

    Dim strName As String
    
    If SaveAsUI Then
        strName = Sheet1.Range("A1") & "_" & Sheet1.Range("B1").Value
        ThisWorkbook.SaveAs strName
        Cancel = True
        Exit Sub
    End If
    
End Sub