Bonjour,
2 propositions à tester !?
Cdlt.
Public Sub SaveSheetInNewBook_1()
Dim wb As Workbook, ws As Worksheet, strPath As String, strFile As String
Set wb = ThisWorkbook
Set ws = wb.Worksheets("BdD")
strPath = Environ("UserProfile") & "\Desktop\"
strFile = "extraction base de données " & Format(VBA.Date, "yyyymmdd") & ".xlsx"
ws.Copy
With ActiveWorkbook
.SaveAs Filename:=strPath & strFile, FileFormat:=51
.Close savechanges:=False
End With
End Sub
Public Sub SaveSheetInNewBook_2()
Dim wb As Workbook, ws As Worksheet, oWSHShell As Object, strPath As String, strFile As String
Set wb = ThisWorkbook
Set ws = wb.Worksheets("BdD")
Set oWSHShell = CreateObject("WScript.Shell")
strPath = oWSHShell.specialfolders("Desktop") & Application.PathSeparator
strFile = "extraction base de données " & Format(VBA.Date, "yyyymmdd") & ".xlsx"
ws.Copy
Application.DisplayAlerts = False
With ActiveWorkbook
.SaveAs Filename:=strPath & strFile, FileFormat:=51
.Close savechanges:=False
End With
Set oWSHShell = Nothing
End Sub