Bonjour,
Je vous sollicite car je bloque sur un code, le message d'erreur 1004 apparaît
La feuille "Paramètres" est bien existante et est correctement orthographiée
Lorsque je mets mon curseur sur "Nom" ou "Application.ActivePrinter", l'imprimante apparaît bien. Donc, je ne comprends pas bien ce qui peut bloquer
Est-ce un problème de réseau? Ne08? Ne04?
Merci d'avance pour votre aide
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim aa As Byte
Dim Nom As String
For aa = 0 To 9
Nom = Sheets("Paramètres").Range("K2").Value
On Error Resume Next
Application.ActivePrinter = Nom
If ActivePrinter = Nom Then Exit For
Next
Application.ActivePrinter = Nom
Sheets("Saisie").Select
Application.CommandBars("cell").Enabled = True
Application.CommandBars("Ply").Enabled = True
Application.CommandBars("Visual Basic").Enabled = True
Application.CommandBars("Macro").Enabled = True
Application.EnableEvents = True
On Error Resume Next
If Workbooks(Sheets("Paramètres").Range("M2").Value).IsAddin = False Then
Workbooks(Sheets("Paramètres").Range("M2").Value).IsAddin = True
End If
Workbooks(Sheets("Paramètres").Range("M2").Value).Close savechanges:=True
On Error GoTo 0
If ThisWorkbook.ReadOnly Then
ThisWorkbook.Close savechanges:=False
Else
ActiveWorkbook.Close savechanges:=True
End If
Application.StatusBar = ""
Sheets("Utilisateurs").Visible = xlSheetVeryHidden
End Sub