Private Sub CmDbibli_Click()
Unload Me
Dim Clas As Workbook, NomClass As String, Feuil As Worksheet
If WB_BASE_ARTICLES = "" Then MsgBox "Variable Public WB_BASE_articles As String non initialisée.", vbCritical, Me.Caption: Exit Sub
If WS_ARTICLES = "" Then MsgBox "Variable Public WS_articles As String non initialisée.", vbCritical, Me.Caption: Exit Sub
If IsEmpty(RG_DÉBUT_BASE_CLIENT) Then MsgBox "Variable Public RG_DÉBUT_BASE_ARTICLES non définie As Range.", vbCritical, Me.Caption: Exit Sub
'ElseIf UCase(Clas.FullName) <> UCase(WB_BASE_articles) Then MsgBox "Un classeur """ & Clas.Name & """ est déjà ouvert mais vient de" '_ etc.
On Error Resume Next
NomClass = Mid$(WB_BASE_ARTICLES, InStrRev(WB_BASE_ARTICLES, "\") + 1)
Set Clas = Workbooks(NomClass)
If Err Then
Err.Clear: Set Clas = Workbooks.Open(WB_BASE_ARTICLES)
If Err Then MsgBox "Il n'existe pas de classeur """ & WB_BASE_ARTICLES & """.", vbCritical, Me.Caption: Exit Sub
ElseIf UCase(Clas.FullName) <> UCase(WB_BASE_ARTICLES) Then MsgBox "Un classeur """ & Clas.Name & """ est déjà ouvert mais vient de" '_
'ElseIf Clas.FullName <> WB_BASE_articles Then MsgBox "Un classeur """ & Clas.Name & """ est déjà ouvert mais vient de" _
& vbLf & Clas.FullName & " et non de" & vbLf & WB_BASE_articles, vbCritical, Me.Caption: Exit Sub
End If
Set Feuil = Clas.Worksheets(WS_ARTICLES)
If Err Then MsgBox "Le classeur """ & Clas.Name & """ ne contient pas de feuille """ & WS_ARTICLES & """.", _
vbCritical, Me.Caption: Exit Sub
Set RG_DÉBUT_BASE_ARTICLES = ARTICLES.[B2] '<+++++++++bug ici a ARTICLES
Unload Me
bibliothèques.Show
End Sub