Bonjour à tous,

J'ai 1 répertoire avec différentes .xls dedans. Il me faut renommer tous ces fichiers (il me faut respecter 1 certain format) pour que je puisse les utilisés plus tard.

Afin de le renommer je dois aller chercher des infos dans le .xls. Une fois ces infos récupérées (j'en ai la preuve), je voudrais renommer mon .xls.

J'ai testé différentes manières mais sans succès.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Private Sub cmd_rename_Click()
    Application.ScreenUpdating = False      ' hide action on .xls
    Workbooks.Open "C:\Documents and Settings\train3_hanms\Desktop\code\tmlp.xls"     ' open the .xls
    ActiveSheet.UsedRange.Select    ' active the .xls
    
    Dim fic_name As String
    Dim msg As String
    fic_name = Application.Cells(1, 1) & "_" & Application.Cells(1, 2) & "_" & Application.Cells(1, 3) & "_" & Application.Cells(1, 4)
    
    fic_name = fic_name & ".xls"
    msg = MsgBox(fic_name)
    Name "C:\Documents and Settings\train3_hanms\Desktop\code\tmlp.xls" As "C:\Documents and Settings\train3_hanms\Desktop\code\ & fic_name"

End Sub
Comment renommer mon .xls avec mon "fic_name" ?