Public Sub reprise() UserForm1.Show End Sub
Private Sub CommandButton1_Click() CommandButton2.Caption = "coucou" MsgBox "le caption de commanbutton2 a bien été modifié" Application.OnTime Now, "reprise" 'on en a besoin, si l'on veut revoir le userform Dim Contrôle_Image1 As OLEObject Set Contrôle_Image1 = ActiveSheet.OLEObjects.Add(ClassType:="Forms.Image.1", Link:=False, _ DisplayAsIcon:=False, Left:=210, Top:=124.5, Width:=123, Height:=49.5) MsgBox "regardez ce qu'il va redevenir à la sortie de cette sub" End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionOption Explicit Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Public toto As String Public Sub reprise() UserForm1.Show MsgBox FindWindow(vbNullString, UserForm1.Caption) End Sub
Option Explicit Private Sub CommandButton1_Click() MsgBox FindWindow(vbNullString, Me.Caption) CommandButton2.Caption = "coucou" MsgBox "le caption de commanbutton2 a bien été modifié" Application.OnTime Now, "reprise" 'on en a besoin, si l'on veut revoir le userform Dim Contrôle_Image1 As OLEObject 'GoTo 10 Set Contrôle_Image1 = ActiveSheet.OLEObjects.Add(ClassType:="Forms.Image.1", Link:=False, _ DisplayAsIcon:=False, Left:=210, Top:=124.5, Width:=123, Height:=49.5) 10 MsgBox "regardez ce qu'il va redevenir à la sortie de cette sub" MsgBox FindWindow(vbNullString, Me.Caption) End Sub Private Sub CommandButton2_Click() MsgBox FindWindow(vbNullString, Me.Caption) CommandButton2.Caption = "eee" End Sub
Option Explicit Public test As String Public Sub essai() MsgBox "la valeur de test est à l'entrée dans la sub essai ===> " & test test = "bonjour" MsgBox "la valeur de test est maintenant ===> " & test 'GoTo 10 Dim Contrôle_Image1 As OLEObject Set Contrôle_Image1 = ActiveSheet.OLEObjects.Add(ClassType:="Forms.Image.1", Link:=False, _ DisplayAsIcon:=False, Left:=210, Top:=124.5, Width:=123, Height:=49.5) 10 MsgBox "la valeur de test est encore là juste avant la sortie de la sub essai ===>> " & test & vbCrLf & _ "relancez la macro essai et regardez ce qu'est devenue cette valeur en y entrant !" End Sub
Programmatically add a non-ActiveX control to the worksheet instead of an ActiveX control. You can find Non-ActiveX controls on the Forms toolbar.
Microsoft Excel 97 provides non-ActiveX controls for compatibility with earlier versions of Microsoft Excel.
Article ID: 155051 - Last Review: October 11, 2006 - Revision: 1.2