Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

code macro d'impression

7 réponses
Avatar
sunburn
Bonjour,
j'ai actuellement un code macro pour mon impression personnalisée, qui me
convient assez bien : j'ai 4 choix d'impression en tout.
---
Private Sub OK_Click()
ImpChoix.Hide
If ImpChoix.Choix1 Then
Application.Dialogs(xlDialogPrinterSetup).Show 'lance la boite de
dialogue Choix de l'imprimante
ThisWorkbook.IsAddin = False
ActiveSheet.PrintOut
Unload Me
Else
End If
------
le seul hic, c'est quand je clic sur OK, il m'ouvre une fenêtre de choix
d'imprimante (ça je le veux).
si je me suis trompé dans mon choix d'impression, et que je clique sur
"annuler" au niveau de mon choix d'imprimante, il imprime tout de même.

A part mettre un message "etes vosu sur de votre choix?" en amont de la
fenetre imprimante, que puis-je faire ??

je vous remercie.
YANN

7 réponses

Avatar
MichDenis
Bonjour Sunburn,

Pour pouvoir annuler la fenêtre du choix de l'imprimante, tu fais comme ceci :

Dim X As Variant

X = Application.Dialogs(xlDialogPrinterSetup).Show
'Si annuler -> fin de la procédure
If X = False Then Exit Sub

Et le reste de ton code





"sunburn" a écrit dans le message de groupe de
discussion :
Bonjour,
j'ai actuellement un code macro pour mon impression personnalisée, qui me
convient assez bien : j'ai 4 choix d'impression en tout.
---
Private Sub OK_Click()
ImpChoix.Hide
If ImpChoix.Choix1 Then
Application.Dialogs(xlDialogPrinterSetup).Show 'lance la boite de
dialogue Choix de l'imprimante
ThisWorkbook.IsAddin = False
ActiveSheet.PrintOut
Unload Me
Else
End If
------
le seul hic, c'est quand je clic sur OK, il m'ouvre une fenêtre de choix
d'imprimante (ça je le veux).
si je me suis trompé dans mon choix d'impression, et que je clique sur
"annuler" au niveau de mon choix d'imprimante, il imprime tout de même.

A part mettre un message "etes vosu sur de votre choix?" en amont de la
fenetre imprimante, que puis-je faire ??

je vous remercie.
YANN
Avatar
FFO
Salut à toi

Mets ceci :

Imprimante = Application.Dialogs(xlDialogPrinterSetup).Show 'lance la boite
de dialogue Choix de l'imprimante
If Imprimante = "Vrai" Then
ThisWorkbook.IsAddin = False
ActiveSheet.PrintOut
End If

Dans ton code celà donne :

Private Sub OK_Click()
ImpChoix.Hide
If ImpChoix.Choix1 Then
Imprimante = Application.Dialogs(xlDialogPrinterSetup).Show 'lance la boite
de dialogue Choix de l'imprimante
If Imprimante = "Vrai" Then
ThisWorkbook.IsAddin = False
ActiveSheet.PrintOut
End If
Unload Me
Else
End If


celà devrait convenir
Dis moi !!!!
Avatar
FFO
Salut à toi

Mets ceci :

Imprimante = Application.Dialogs(xlDialogPrinterSetup).Show 'lance la boite
de dialogue Choix de l'imprimante
If Imprimante = "Vrai" Then
ThisWorkbook.IsAddin = False
ActiveSheet.PrintOut
End If

Dans ton code celà donne :

Private Sub OK_Click()
ImpChoix.Hide
If ImpChoix.Choix1 Then
Imprimante = Application.Dialogs(xlDialogPrinterSetup).Show 'lance la boite
de dialogue Choix de l'imprimante
If Imprimante = "Vrai" Then
ThisWorkbook.IsAddin = False
ActiveSheet.PrintOut
End If
Unload Me
Else
End If


celà devrait convenir
Dis moi !!!!


"sunburn" wrote:

Bonjour,
j'ai actuellement un code macro pour mon impression personnalisée, qui me
convient assez bien : j'ai 4 choix d'impression en tout.
---
Private Sub OK_Click()
ImpChoix.Hide
If ImpChoix.Choix1 Then
Application.Dialogs(xlDialogPrinterSetup).Show 'lance la boite de
dialogue Choix de l'imprimante
ThisWorkbook.IsAddin = False
ActiveSheet.PrintOut
Unload Me
Else
End If
------
le seul hic, c'est quand je clic sur OK, il m'ouvre une fenêtre de choix
d'imprimante (ça je le veux).
si je me suis trompé dans mon choix d'impression, et que je clique sur
"annuler" au niveau de mon choix d'imprimante, il imprime tout de même.

A part mettre un message "etes vosu sur de votre choix?" en amont de la
fenetre imprimante, que puis-je faire ??

je vous remercie.
YANN


Avatar
isabelle
bonjour Yann,

enlecve la ligne : ActiveSheet.PrintOut

Private Sub OK_Click()
ImpChoix.Hide
If ImpChoix.Choix1 Then
Application.Dialogs(xlDialogPrinterSetup).Show 'lance la boite de
dialogue Choix de l'imprimante
ThisWorkbook.IsAddin = False
Unload Me
Else
End If
End Sub

isabelle




sunburn a écrit :
Bonjour,
j'ai actuellement un code macro pour mon impression personnalisée, qui me
convient assez bien : j'ai 4 choix d'impression en tout.
---
Private Sub OK_Click()
ImpChoix.Hide
If ImpChoix.Choix1 Then
Application.Dialogs(xlDialogPrinterSetup).Show 'lance la boite de
dialogue Choix de l'imprimante
ThisWorkbook.IsAddin = False
ActiveSheet.PrintOut
Unload Me
Else
End If
------
le seul hic, c'est quand je clic sur OK, il m'ouvre une fenêtre de choix
d'imprimante (ça je le veux).
si je me suis trompé dans mon choix d'impression, et que je clique sur
"annuler" au niveau de mon choix d'imprimante, il imprime tout de même.

A part mettre un message "etes vosu sur de votre choix?" en amont de la
fenetre imprimante, que puis-je faire ??

je vous remercie.
YANN



Avatar
FFO
Salut à toi

Mets ceci :

Imprimante = Application.Dialogs(xlDialogPrinterSetup).Show 'lance la boite
de dialogue Choix de l'imprimante
If Imprimante = "Vrai" Then
ThisWorkbook.IsAddin = False
ActiveSheet.PrintOut
End If

Dans ton code celà donne :

Private Sub OK_Click()
ImpChoix.Hide
If ImpChoix.Choix1 Then
Imprimante = Application.Dialogs(xlDialogPrinterSetup).Show 'lance la boite
de dialogue Choix de l'imprimante
If Imprimante = "Vrai" Then
ThisWorkbook.IsAddin = False
ActiveSheet.PrintOut
End If
Unload Me
Else
End If


celà devrait convenir
Dis moi !!!!


"sunburn" a écrit :

Bonjour,
j'ai actuellement un code macro pour mon impression personnalisée, qui me
convient assez bien : j'ai 4 choix d'impression en tout.
---
Private Sub OK_Click()
ImpChoix.Hide
If ImpChoix.Choix1 Then
Application.Dialogs(xlDialogPrinterSetup).Show 'lance la boite de
dialogue Choix de l'imprimante
ThisWorkbook.IsAddin = False
ActiveSheet.PrintOut
Unload Me
Else
End If
------
le seul hic, c'est quand je clic sur OK, il m'ouvre une fenêtre de choix
d'imprimante (ça je le veux).
si je me suis trompé dans mon choix d'impression, et que je clique sur
"annuler" au niveau de mon choix d'imprimante, il imprime tout de même.

A part mettre un message "etes vosu sur de votre choix?" en amont de la
fenetre imprimante, que puis-je faire ??

je vous remercie.
YANN


Avatar
FFO
Salut à toi

Mets ceci :

Imprimante = Application.Dialogs(xlDialogPrinterSetup).Show 'lance la boite
de dialogue Choix de l'imprimante
If Imprimante = "Vrai" Then
ThisWorkbook.IsAddin = False
ActiveSheet.PrintOut
End If

Dans ton code celà donne :

Private Sub OK_Click()
ImpChoix.Hide
If ImpChoix.Choix1 Then
Imprimante = Application.Dialogs(xlDialogPrinterSetup).Show 'lance la boite
de dialogue Choix de l'imprimante
If Imprimante = "Vrai" Then
ThisWorkbook.IsAddin = False
ActiveSheet.PrintOut
End If
Unload Me
Else
End If


celà devrait convenir
Dis moi !!!!


"sunburn" wrote:

Bonjour,
j'ai actuellement un code macro pour mon impression personnalisée, qui me
convient assez bien : j'ai 4 choix d'impression en tout.
---
Private Sub OK_Click()
ImpChoix.Hide
If ImpChoix.Choix1 Then
Application.Dialogs(xlDialogPrinterSetup).Show 'lance la boite de
dialogue Choix de l'imprimante
ThisWorkbook.IsAddin = False
ActiveSheet.PrintOut
Unload Me
Else
End If
------
le seul hic, c'est quand je clic sur OK, il m'ouvre une fenêtre de choix
d'imprimante (ça je le veux).
si je me suis trompé dans mon choix d'impression, et que je clique sur
"annuler" au niveau de mon choix d'imprimante, il imprime tout de même.

A part mettre un message "etes vosu sur de votre choix?" en amont de la
fenetre imprimante, que puis-je faire ??

je vous remercie.
YANN


Avatar
sunburn
Salut,
je te remercie, ça marche du tonner.

YANN

"FFO" a écrit :

Salut à toi

Mets ceci :

Imprimante = Application.Dialogs(xlDialogPrinterSetup).Show 'lance la boite
de dialogue Choix de l'imprimante
If Imprimante = "Vrai" Then
ThisWorkbook.IsAddin = False
ActiveSheet.PrintOut
End If

Dans ton code celà donne :

Private Sub OK_Click()
ImpChoix.Hide
If ImpChoix.Choix1 Then
Imprimante = Application.Dialogs(xlDialogPrinterSetup).Show 'lance la boite
de dialogue Choix de l'imprimante
If Imprimante = "Vrai" Then
ThisWorkbook.IsAddin = False
ActiveSheet.PrintOut
End If
Unload Me
Else
End If


celà devrait convenir
Dis moi !!!!