2 years ago

#74262

test-img

VBA_TRAINING

VBA Save a Workbook

There is my code where I try to Save a Workbook in a specific place:

Private Sub zouzou()

    Nom = Cherche("Z:\3_BASE\WORK\BD\01 - PRODUCTION\" & SE & "\" & Batch & "\" & TMD & "\01 - ANALYSE IMPACT\")
    
    FDP = "Z:\3_BASE\WORK\BD\01 - PRODUCTION\" & SE & "\" & Batch & "\" & TMD & "\01 - ANALYSE IMPACT\" & Nom
    
    Enregistrement FDP, Nom

End Sub
Private Sub Enregistrement(Chemin, Nom)
    
    DossierConcat = "Z:\3_BASE\WORK\BD\01 - PRODUCTION" & SE & "\" & Batch & "\" & TMD & "\99 - AS DATA VERIFICATION\Input\"
   
    Set WB1 = Workbooks.Open(Chemin)
    
    WB1.SaveAs Filename:=DossierConcat & Nom
    
    Workbooks(Chemin).Close False
    
End Sub

My code work until the line WB1.SaveAs Filename:=DossierConcat & Nom

Nom = ZOZOT.xlsx And I get error message:

"Runtime Error '1004': Method 'SaveAs' of object '_Workbook' failed"

I don't understand why I got this message, any ideas?

excel

vba

save

0 Answers

Your Answer

Accepted video resources