Re : Macro Ouvrir classeur excel
Merci Pierrot,
Dans ton exemple, je ne vois pas où tu place le chemin du fichier à chercher, j'ai essayé cela :
Option Explicit
Sub testo()
Dim r As String, f As String
ThisWorkbook.Path = "c:chemin"
r = ThisWorkbook.Path & "\"
f = Dir(r & "*" & Range("A2").Value & ".xls")
Do While f <> ""
If MsgBox(f, vbYesNo) = vbYes Then Workbooks.Open r & f
f = Dir
Loop
End Sub
et cela me renvoie : erreur de compilation impossible d'affecter à une propriété en lecture seule et il me surligne le .Path
Option Explicit
Sub testo()
Dim r As String, f As String
ThisWorkbook.Path = "c:chemin"
r = ThisWorkbook.Path & "\"
f = Dir(r & "*" & Range("A2").Value & ".xls")
Do While f <> ""
If MsgBox(f, vbYesNo) = vbYes Then Workbooks.Open r & f
f = Dir
Loop
End Sub
Merci