je réussi à imprimer mon userform avec ce code mais les commandButton
s'imprime aussi,
auriez vous une idée pour ne pas imprimer certain controls lors de
l'impression du UF,
merci! bon matin et bon café,
isabelle
Private Declare Sub keybd_event Lib "user32" ( _
ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, _
ByVal dwExtraInfo As Long)
Private Sub CommandButton1_Click()
For Each ctrl In Me.Controls
If Left(ctrl.Name, 13) = "CommandButton" Then ctrl.Visible = False
Next
PrintUserform
For Each ctrl In Me.Controls
If Left(ctrl.Name, 13) = "CommandButton" Then ctrl.Visible = True
Next
End Sub
Sub PrintUserform()
Dim Ws As Worksheet
keybd_event vbKeySnapshot, 1, 0&, 0&
DoEvents
Set Ws = Sheets("Print")
Ws.Paste
With Ws
.Shapes(1).Top = .Range("A1").Top
.Shapes(1).Left = .Range("A1").Left
.Shapes(1).Height = 798
.Shapes(1).Width = 990
.PageSetup.CenterHorizontally = True
.PageSetup.CenterVertically = True
.PrintOut
End With
End Sub
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
michdenis
Bonjour,
Ajoute une ligne de code à ceci ;
Private Sub CommandButton1_Click() For Each ctrl In Me.Controls If Left(ctrl.Name, 13) = "CommandButton" Then ctrl.Visible = False Next '*******Ligne à ajouter********** Me.Repaint '**********************************
PrintUserform For Each ctrl In Me.Controls If Left(ctrl.Name, 13) = "CommandButton" Then ctrl.Visible = True Next End Sub
"isabelle" a écrit dans le message de groupe de discussion : # bonjour à tous,
je réussi à imprimer mon userform avec ce code mais les commandButton s'imprime aussi, auriez vous une idée pour ne pas imprimer certain controls lors de l'impression du UF, merci! bon matin et bon café, isabelle
Private Declare Sub keybd_event Lib "user32" ( _ ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, _ ByVal dwExtraInfo As Long)
Private Sub CommandButton1_Click() For Each ctrl In Me.Controls If Left(ctrl.Name, 13) = "CommandButton" Then ctrl.Visible = False Next PrintUserform For Each ctrl In Me.Controls If Left(ctrl.Name, 13) = "CommandButton" Then ctrl.Visible = True Next End Sub
Sub PrintUserform() Dim Ws As Worksheet keybd_event vbKeySnapshot, 1, 0&, 0& DoEvents Set Ws = Sheets("Print") Ws.Paste With Ws .Shapes(1).Top = .Range("A1").Top .Shapes(1).Left = .Range("A1").Left .Shapes(1).Height = 798 .Shapes(1).Width = 990 .PageSetup.CenterHorizontally = True .PageSetup.CenterVertically = True .PrintOut End With End Sub
Bonjour,
Ajoute une ligne de code à ceci ;
Private Sub CommandButton1_Click()
For Each ctrl In Me.Controls
If Left(ctrl.Name, 13) = "CommandButton" Then ctrl.Visible = False
Next
'*******Ligne à ajouter**********
Me.Repaint
'**********************************
PrintUserform
For Each ctrl In Me.Controls
If Left(ctrl.Name, 13) = "CommandButton" Then ctrl.Visible = True
Next
End Sub
"isabelle" <i@v> a écrit dans le message de groupe de discussion :
#8cRQfBwKHA.3764@TK2MSFTNGP04.phx.gbl...
bonjour à tous,
je réussi à imprimer mon userform avec ce code mais les commandButton
s'imprime aussi,
auriez vous une idée pour ne pas imprimer certain controls lors de
l'impression du UF,
merci! bon matin et bon café,
isabelle
Private Declare Sub keybd_event Lib "user32" ( _
ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, _
ByVal dwExtraInfo As Long)
Private Sub CommandButton1_Click()
For Each ctrl In Me.Controls
If Left(ctrl.Name, 13) = "CommandButton" Then ctrl.Visible = False
Next
PrintUserform
For Each ctrl In Me.Controls
If Left(ctrl.Name, 13) = "CommandButton" Then ctrl.Visible = True
Next
End Sub
Sub PrintUserform()
Dim Ws As Worksheet
keybd_event vbKeySnapshot, 1, 0&, 0&
DoEvents
Set Ws = Sheets("Print")
Ws.Paste
With Ws
.Shapes(1).Top = .Range("A1").Top
.Shapes(1).Left = .Range("A1").Left
.Shapes(1).Height = 798
.Shapes(1).Width = 990
.PageSetup.CenterHorizontally = True
.PageSetup.CenterVertically = True
.PrintOut
End With
End Sub
Private Sub CommandButton1_Click() For Each ctrl In Me.Controls If Left(ctrl.Name, 13) = "CommandButton" Then ctrl.Visible = False Next '*******Ligne à ajouter********** Me.Repaint '**********************************
PrintUserform For Each ctrl In Me.Controls If Left(ctrl.Name, 13) = "CommandButton" Then ctrl.Visible = True Next End Sub
"isabelle" a écrit dans le message de groupe de discussion : # bonjour à tous,
je réussi à imprimer mon userform avec ce code mais les commandButton s'imprime aussi, auriez vous une idée pour ne pas imprimer certain controls lors de l'impression du UF, merci! bon matin et bon café, isabelle
Private Declare Sub keybd_event Lib "user32" ( _ ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, _ ByVal dwExtraInfo As Long)
Private Sub CommandButton1_Click() For Each ctrl In Me.Controls If Left(ctrl.Name, 13) = "CommandButton" Then ctrl.Visible = False Next PrintUserform For Each ctrl In Me.Controls If Left(ctrl.Name, 13) = "CommandButton" Then ctrl.Visible = True Next End Sub
Sub PrintUserform() Dim Ws As Worksheet keybd_event vbKeySnapshot, 1, 0&, 0& DoEvents Set Ws = Sheets("Print") Ws.Paste With Ws .Shapes(1).Top = .Range("A1").Top .Shapes(1).Left = .Range("A1").Left .Shapes(1).Height = 798 .Shapes(1).Width = 990 .PageSetup.CenterHorizontally = True .PageSetup.CenterVertically = True .PrintOut End With End Sub
isabelle
salut Denis,
c'était bien la ligne qu'il fallait ajouter, tout fonctionne bien, merci, gros bisou* isabelle
Le 2010-03-10 06:25, michdenis a écrit :
Bonjour,
Ajoute une ligne de code à ceci ;
Private Sub CommandButton1_Click() For Each ctrl In Me.Controls If Left(ctrl.Name, 13) = "CommandButton" Then ctrl.Visible = False Next '*******Ligne à ajouter********** Me.Repaint '**********************************
PrintUserform For Each ctrl In Me.Controls If Left(ctrl.Name, 13) = "CommandButton" Then ctrl.Visible = True Next End Sub
"isabelle" a écrit dans le message de groupe de discussion : # bonjour à tous,
je réussi à imprimer mon userform avec ce code mais les commandButton s'imprime aussi, auriez vous une idée pour ne pas imprimer certain controls lors de l'impression du UF, merci! bon matin et bon café, isabelle
Private Declare Sub keybd_event Lib "user32" ( _ ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, _ ByVal dwExtraInfo As Long)
Private Sub CommandButton1_Click() For Each ctrl In Me.Controls If Left(ctrl.Name, 13) = "CommandButton" Then ctrl.Visible = False Next PrintUserform For Each ctrl In Me.Controls If Left(ctrl.Name, 13) = "CommandButton" Then ctrl.Visible = True Next End Sub
Sub PrintUserform() Dim Ws As Worksheet keybd_event vbKeySnapshot, 1, 0&, 0& DoEvents Set Ws = Sheets("Print") Ws.Paste With Ws .Shapes(1).Top = .Range("A1").Top .Shapes(1).Left = .Range("A1").Left .Shapes(1).Height = 798 .Shapes(1).Width = 990 .PageSetup.CenterHorizontally = True .PageSetup.CenterVertically = True .PrintOut End With End Sub
salut Denis,
c'était bien la ligne qu'il fallait ajouter, tout fonctionne bien,
merci, gros bisou*
isabelle
Le 2010-03-10 06:25, michdenis a écrit :
Bonjour,
Ajoute une ligne de code à ceci ;
Private Sub CommandButton1_Click()
For Each ctrl In Me.Controls
If Left(ctrl.Name, 13) = "CommandButton" Then ctrl.Visible = False
Next
'*******Ligne à ajouter**********
Me.Repaint
'**********************************
PrintUserform
For Each ctrl In Me.Controls
If Left(ctrl.Name, 13) = "CommandButton" Then ctrl.Visible = True
Next
End Sub
"isabelle"<i@v> a écrit dans le message de groupe de discussion :
#8cRQfBwKHA.3764@TK2MSFTNGP04.phx.gbl...
bonjour à tous,
je réussi à imprimer mon userform avec ce code mais les commandButton
s'imprime aussi,
auriez vous une idée pour ne pas imprimer certain controls lors de
l'impression du UF,
merci! bon matin et bon café,
isabelle
Private Declare Sub keybd_event Lib "user32" ( _
ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, _
ByVal dwExtraInfo As Long)
Private Sub CommandButton1_Click()
For Each ctrl In Me.Controls
If Left(ctrl.Name, 13) = "CommandButton" Then ctrl.Visible = False
Next
PrintUserform
For Each ctrl In Me.Controls
If Left(ctrl.Name, 13) = "CommandButton" Then ctrl.Visible = True
Next
End Sub
Sub PrintUserform()
Dim Ws As Worksheet
keybd_event vbKeySnapshot, 1, 0&, 0&
DoEvents
Set Ws = Sheets("Print")
Ws.Paste
With Ws
.Shapes(1).Top = .Range("A1").Top
.Shapes(1).Left = .Range("A1").Left
.Shapes(1).Height = 798
.Shapes(1).Width = 990
.PageSetup.CenterHorizontally = True
.PageSetup.CenterVertically = True
.PrintOut
End With
End Sub
c'était bien la ligne qu'il fallait ajouter, tout fonctionne bien, merci, gros bisou* isabelle
Le 2010-03-10 06:25, michdenis a écrit :
Bonjour,
Ajoute une ligne de code à ceci ;
Private Sub CommandButton1_Click() For Each ctrl In Me.Controls If Left(ctrl.Name, 13) = "CommandButton" Then ctrl.Visible = False Next '*******Ligne à ajouter********** Me.Repaint '**********************************
PrintUserform For Each ctrl In Me.Controls If Left(ctrl.Name, 13) = "CommandButton" Then ctrl.Visible = True Next End Sub
"isabelle" a écrit dans le message de groupe de discussion : # bonjour à tous,
je réussi à imprimer mon userform avec ce code mais les commandButton s'imprime aussi, auriez vous une idée pour ne pas imprimer certain controls lors de l'impression du UF, merci! bon matin et bon café, isabelle
Private Declare Sub keybd_event Lib "user32" ( _ ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, _ ByVal dwExtraInfo As Long)
Private Sub CommandButton1_Click() For Each ctrl In Me.Controls If Left(ctrl.Name, 13) = "CommandButton" Then ctrl.Visible = False Next PrintUserform For Each ctrl In Me.Controls If Left(ctrl.Name, 13) = "CommandButton" Then ctrl.Visible = True Next End Sub
Sub PrintUserform() Dim Ws As Worksheet keybd_event vbKeySnapshot, 1, 0&, 0& DoEvents Set Ws = Sheets("Print") Ws.Paste With Ws .Shapes(1).Top = .Range("A1").Top .Shapes(1).Left = .Range("A1").Left .Shapes(1).Height = 798 .Shapes(1).Width = 990 .PageSetup.CenterHorizontally = True .PageSetup.CenterVertically = True .PrintOut End With End Sub