Sub Enregistrer()
Dim Nom As String
Nom = Range("L1") & ".xlsm"
If ThisWorkbook.Path = "" Then 'si le document n'a jamais été enregistré
SendKeys Nom
Application.Dialogs(xlDialogSaveAs).Show 'boîte de dialogue Enregistrer sous
Else
If Range("L1") = "" Then MsgBox "Entrez le nom du fichier en I1", 48: Range("L1").Select: Exit Sub
If MsgBox("Voulez-vous enregistrer le fichier sous le nom " & Nom & " ?", 4) = 6 Then
On Error Resume Next
ThisWorkbook.SaveAs ThisWorkbook.Path & "\" & Nom 'Enregistre dans le même dossier
If Err Then MsgBox "Le nom proposé contient des caractères interdits", 48: Range("L1").Select
End If
End If
End Sub
'Private classeurDeBase As Excel.Workbook
Private Sub Envoyer()
ActiveWorkbook.SendMail Recipients:="xxx@hotmail.com", _
Subject:="Test envoi classeur", _
ReturnReceipt:=True
' URLto = "mailto:xxx@hotmail.com" & "?subject=test d'envoi de fichier" & "&body=" & Msg
' ActiveWorkbook.FollowHyperlink Address:=URLto
End Sub
Vais le faire ainsi dans ce cas