1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
Function FichierOuvert(ByVal NomDuFichier As String, ByVal PositionFin As Integer) As Boolean
Dim WbEnCours As Workbook
FichierOuvert = False
If Workbooks.Count = 0 Then
Exit Function
Else
For Each WbEnCours In Workbooks
With WbEnCours
If LCase(Mid(.Name, 1, PositionFin)) = LCase(Mid(NomDuFichier, 1, PositionFin)) Then
FichierOuvert = True
.Activate
Exit Function
End If
End With
Next WbEnCours
End If
End Function
Sub Test()
MsgBox FichierOuvert("XXXXXX 2020-09-01.xlsm", 6)
End Sub |
Partager