UserForm permanece en segundo plano

Resuelto
irongege Mensajes publicados 38993 Fecha de registro   Estado Moderador Última intervención   -  
irongege Mensajes publicados 38993 Fecha de registro   Estado Moderador Última intervención   -
Bonjour,

Voici la traduction fidèle en espagnol du texte fourni, en conservant la structure HTML et le code tel quel.

Hola,

Tengo un problema con un UserForm que no quiere ponerse al primer plano cuando se hace clic en un botón para mostrarlo, mientras que funciona con otro UserForm.

Aquí está el código para el primer userform que se muestra bien al primer plano:

Private Sub validnumbatchf2_Click() nbrcarac = Len(TextBoxnumbatchf2.Value) If TextBoxnumbatchf2.Text = "" Or nbrcarac < 9 Or TextBoxdebcyf2.Text = "" Then MsgBox "Le numéro du batch ou l'heure saisi sont incorrects" Else validnumbatchf2.Visible = False matf2.Show ' UserForm que debe s'afficher End If End Sub

el código del userform que se ha puesto en primer plano correctamente

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) If CloseMode = 0 Then MsgBox "Vous ne pouvez pas fermer cette fenêtre.", 16 Cancel = CloseMode = 0 End If End Sub Private Sub validmatf2_Click() If Application.CountIf(Range("A92:A109"), TextBox1) >= 1 Then Range("B85").Value = TextBox1.Text Suivi.Labelmatdcyf2.Caption = TextBox1.Text Suivi.Show Suivi.MultiPage1.Value = 2 Suivi.debcyf2.Visible = True ' Bouton de procédure d'enregistrement TextBox1.Text = "" matf2.Hide Else: MsgBox "Vous ne disposez pas des droits nécessaires" End If End Sub

Lors d'un clic sur le bouton "Suivi.debcyf2", il y a enregistrement de données

Private Sub debcyf2_Click() hrdebcyf2.Caption = Format(Date, "dd.mm.yy") Workbooks.Open "C:\Suivi_DLC\Archives_" & Range("C33").Value & "\Batch_BL_N°" & Range("B27").Value & "\Docsuivicharge.xls" [AE114] = Labelnumconfigf2.Caption [AF115] = TextBoxnumbatchf2.Text [AH113] = [Y7] [AE116] = TextBoxdebcyf2.Text [U9] = [AE116] [U11] = Labelnumconfigf2.Caption [S1] = hrdebcyf2.Caption [D42] = Labelmatdcyf2.Caption Call nomprenom [G42] = Labelnomdcyf2.Caption [K42] = Labelprenomdcyf2.Caption If [D33] = "X" Then ' broche volante 1 [AH120] = "X" End If If [E33] = "X" Then ' broche volante 2 [AH121] = "X" End If If [F33] = "X" Then ' broche volante 3 [AH122] = "X" End If If [G33] = "X" Then ' broche volante 4 [AH123] = "X" End If If [H33] = "X" Then ' broche volante 5 [AH124] = "X" End If If [I33] = "X" Then ' broche volante 6 [AH125] = "X" End If If [J33] = "X" Then ' broche volante 7 [AH126] = "X" End If If [K33] = "X" Then ' broche volante 8 [AH127] = "X" End If If [L33] = "X" Then ' broche volante 9 [AH128] = "X" End If If [M33] = "X" Then ' broche volante 10 [AH129] = "X" End If If [N33] = "X" Then ' broche volante 11 [AH130] = "X" End If If [O33] = "X" Then ' broche volante 12 [AH131] = "X" End If [AI120] = [D31] [AI121] = [E31] [AI122] = [F31] [AI123] = [G31] [AI124] = [H31] [AI125] = [I31] [AI126] = [J31] [AI127] = [K31] [AI128] = [L31] [AI129] = [M31] [AI130] = [N31] [AI131] = [O31] 'Application.Run ("Docsuivicharge.xls!macro5impressionsupervisur") 'Application.Run ("Docsuivicharge.xls!Macro6impressioninfobatchregleur") ActiveWorkbook.Save ActiveWindow.Close '------------------------------------feuille poli --------------------------------------------- Workbooks.Open "C:\Suivi_DLC\Archives_" & Range("C33").Value & "\Batch_BL_N°" & Range("B27").Value & "\Poli.xls" [D1] = TextBoxnumbatchf2.Text 'Application.Run ("Poli.xls!impresspoli") ActiveWorkbook.Save ActiveWindow.Close '------------------------------------fin feuille poli ----------------------------------------- [A46] = Labelnumbf2.Caption [D64] = [A46] [A48] = Labeltablef2 [D66] = [A48] blencycledansf2.Visible = True numblencyclef2.Visible = True numblencyclef2.Caption = ActiveSheet.Cells(46, 1) tableencyclef2.Visible = True numtableencyclef2.Visible = True numtableencyclef2.Caption = ActiveSheet.Cells(48, 1) debcyf2.Visible = False CommandButton5.Visible = True End Sub

Maintenant survient mon problème, lors du clic sur CommandButton5 mon autre userform s'affiche en arrière plan.

Private Sub CommandButton5_Click() matfincyf2.Show CommandButton5.Visible = False End Sub

J'ai essayé en créant une autre userform et le problème reste le même, cette userform reste en arrière plan.

Si quelqu'un avait une idée, ce serait sympa.

Merci

Configuration: 929 + 996 = 2

--
"Je connaissais un sportif qui prétendait avoir plus de ressort que sa montre. Pour le prouver, il a fait la course contre sa montre."

1 respuesta

f894009 Mensajes publicados 17417 Fecha de registro   Estado Miembro Última intervención   1 717
 
Hola,

Necesitaría su archivo sin los datos de las hojas de Excel, solo la parte de userforms

para poner a disposición: hacer clic en el siguiente enlace https://www.cjoint.com/
No olvidar copiar el enlace creado en su próximo mensaje.

Nos vemos (A+).
0
irongege Mensajes publicados 38993 Fecha de registro   Estado Moderador Última intervención   5 128
 
He añadido:
Suivi.Hide en la parte de este código:

Private Sub CommandButton5_Click() Suivi.Hide matfincyf2.Show CommandButton5.Visible = False End Sub


y también esto en la activación de este userform:
Private Sub UserForm_Activate() With Me .StartUpPosition = 3 .Width = Application.Width .Height = Application.Height .Left = 0 .Top = 0 End With End Sub


y se muestra bien en primer plano.
0