Bonjour,
A vue de nez, il faudrait d'abord ouvrir le fichier avant de pouvoir exécuter la macro qu'il contient
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| Sub Test()
Set ofso = CreateObject("Scripting.FileSystemObject")
Source = "C:\Outil RH\Test\"
For Each File In ofso.GetFolder(Source).Files
fichierRma = File.Name
Workbooks.Open (Source & File.Name)
'ActiveWorkbook.RunAutoMacros which:=xlAutoOpen
st = "'" & fichierRma & "'!UnprotectionWbk"
Application.Run st
'Traitement
ActiveWindow.Close
Next
End Sub |
Cette ligne sert à quoi ?
ActiveWorkbook.RunAutoMacros which:=xlAutoOpen
Partager