Bonjour à toutes et tous,
Tout d'abord, je tiens à préciser que je ne suis qu'un apprenti sorcier dans le monde des Macros.
Je tente de créer un fichier macro-enabled à partir su nom contenu dans une cellule, mais j'ai une erreur d'exécution 1004.
L'erreur apparaït sur la ligne: "ActiveWorkbook.SaveAs FileName"
Le nom du fichier est contenu dans la cellule E4
La Macro est la suivante:
Sub ChangingFileName()
Range("E3").Select
Selection.Copy
Range("E4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("E4").Select
Application.CutCopyMode = False
Dim FileName As Variant
Dim ValCellE4 As String
Dim Path As String
ValCellE4 = Range("E4").Value
Path = "D:\_Professional Occupation_\Ortho Clinical Diagnostics\Calendars\"
FileName = Application.GetSaveAsFilename(Path, ValCellE4, ".xlsm", "Excel Macro-Enabled Workbook,*.xlsm", 1)
'Oops, the user backed out of this so don't save the file
If TypeName(FileName) = "Boolean" Then
MsgBox "You didn't save the file!"
Else
'Ok, all is good, we have the details, so go ahead and save the workbook
ActiveWorkbook.SaveAs FileName
MsgBox "File Saved!"
End If
End Sub
Merci d'avance pour vos conseils...