IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Macros et VBA Excel Discussion :

Texte defilent dans un textebox [XL-2007]


Sujet :

Macros et VBA Excel

  1. #1
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2009
    Messages
    38
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2009
    Messages : 38
    Points : 17
    Points
    17
    Par défaut Texte defilent dans un textebox
    Bonjour, je suis nouveau sur le Forum et de plus nouveau dans l'écriture de macr'o sous excel : je me suis lancer il y a 3 jours en regardant sur les Forum.
    Aujourd'hui je rencontre 2 difficulté de taille :
    - Comment créer du texte defilent pour mon userform (sous forme de texbox ou autre ) ? (ex : j'appui sur un bouton qui me permeterait d'diter un texte qui defile)

    - J'ai fait un bouton de validation qui permet de ne plus modifier une textbox (verrouillage de la texbox) seulement le texte verrouillé est grisé : je voudrait qu'il soit d'une autre couleur !


    Je vous remerci par avance

  2. #2
    Rédacteur/Modérateur

    Avatar de Jean-Philippe André
    Homme Profil pro
    Architecte Power Platform, ex-Développeur VBA/C#/VB.Net
    Inscrit en
    Juillet 2007
    Messages
    14 656
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : Canada

    Informations professionnelles :
    Activité : Architecte Power Platform, ex-Développeur VBA/C#/VB.Net
    Secteur : Finance

    Informations forums :
    Inscription : Juillet 2007
    Messages : 14 656
    Points : 34 369
    Points
    34 369
    Par défaut
    bonjour,
    bienvenue sur DVP
    parmi les nombreuses ressources à ta disposition tu trouveras notamment une
    http://office.developpez.com/faq/
    comme le langage VBA permet de travailler sur plusieurs outils, n'oublie de vérifier aussi les des autres applications que celle que tu utilises (ici Excel)
    une réponse apparait donc en faisant une recherche :
    http://access.developpez.com/faq/?page=TAForm#DefilTxt

    Si certains points te paraissent encore compliquées, n'hésite pas à nous poser d'autres questions

  3. #3
    Membre chevronné Avatar de Krovax
    Profil pro
    Inscrit en
    Juillet 2008
    Messages
    1 888
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 888
    Points : 2 168
    Points
    2 168
    Par défaut
    Bonjour pour ton deuxième problème
    Essaye
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    Private Sub CommandButton1_Click()
    TextBox1.Locked = True
    TextBox1.ForeColor = RGB(255, 0, 0)
     
    End Sub
    Pour le premier je te dirais que tu vas sérieusement galérer Excel n'est pas vraiment fait pour ce genre de chose
    Fait une recherche sur le forum tu y trouvera plusieurs exemple. Il va te falloir faire une temporisation qui tourne ne boucle et qui décale le texte a chaque fois. Si ce n'est pas essentiel je te conseillerais de remettre cela a plus tard quand tu sera un peu plus familier avec le VBA. Sinon commence par trouver des code déjà fait teste les et essaye de les comprendre

  4. #4
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2009
    Messages
    38
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2009
    Messages : 38
    Points : 17
    Points
    17
    Par défaut
    Citation Envoyé par jpcheck Voir le message
    bonjour,
    bienvenue sur DVP
    parmi les nombreuses ressources à ta disposition tu trouveras notamment une
    http://office.developpez.com/faq/
    comme le langage VBA permet de travailler sur plusieurs outils, n'oublie de vérifier aussi les des autres applications que celle que tu utilises (ici Excel)
    une réponse apparait donc en faisant une recherche :
    http://access.developpez.com/faq/?page=TAForm#DefilTxt

    Si certains points te paraissent encore compliquées, n'hésite pas à nous poser d'autres questions
    re : j'ai bien vu la FAQ mais cela ne fonctionne pas : je ne trouve pas cela =
    "Mettre la propriété minuterie de l'onglet événements à 500 (ms)."

    J'ai fait mopn etiquette : je l'ai bien renommé en "lblInfos" et mis le code mais rien ne se passe.

    Citation Envoyé par Krovax Voir le message
    Bonjour pour ton deuxième problème
    Essaye
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    Private Sub CommandButton1_Click()
    TextBox1.Locked = True
    TextBox1.ForeColor = RGB(255, 0, 0)
     
    End Sub
    Pour le premier je te dirais que tu vas sérieusement galérer Excel n'est pas vraiment fait pour ce genre de chose
    Fait une recherche sur le forum tu y trouvera plusieurs exemple. Il va te falloir faire une temporisation qui tourne ne boucle et qui décale le texte a chaque fois. Si ce n'est pas essentiel je te conseillerais de remettre cela a plus tard quand tu sera un peu plus familier avec le VBA. Sinon commence par trouver des code déjà fait teste les et essaye de les comprendre
    Merci de vos réponse si rapide : mais pour le changement de couleur cela ne fonctionne pas : voici mon code :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
     
     
    Private Sub CommandButton1_Click()
    For i = 2 To 4
    Controls("TextBox" & i).Value = ""
    Next
    Call EnableControls
    End Sub
     
    Private Sub EnableControls()
       TextBox2.Enabled = CommandButton1.Enabled = True
       TextBox3.Enabled = CommandButton1.Enabled = True
       TextBox4.Enabled = CommandButton1.Enabled = True
    End Sub
    Voici l'apercu de ce que je fait : quand j'appui sur le bouton validé a droite il se grise et se verouille : je souhaite qu'il ne se grise pas ou que je puisse changer la couleur

    Images attachées Images attachées  

  5. #5
    Membre chevronné Avatar de Krovax
    Profil pro
    Inscrit en
    Juillet 2008
    Messages
    1 888
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 888
    Points : 2 168
    Points
    2 168
    Par défaut
    J'aime bien le triple égale mais la il et inutile
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    Private Sub EnableControls()
       TextBox2.Enabled = CommandButton1.Enabled 
       TextBox3.Enabled = CommandButton1.Enabled 
       TextBox4.Enabled = CommandButton1.Enabled 
    End Sub
    Par contre je ne vois pas comment tu as essayé le changement de couleur.
    Je ne sais pas quel contrôle tu veux modifier ni quand. Car le code que tu as donnée permet uniquement de lier la propriété enable de tes textbox a celle d'un controlebutton toujours le même.

    Alors au lieu d'utiliser enable essaye locked cela évitera de griser, il me semble que enable grise forcément mais c'est a vérifier.
    Ensuite essaye d'adapter le code et montre nous la version ou tu as essayé d'adapter

  6. #6
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2009
    Messages
    38
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2009
    Messages : 38
    Points : 17
    Points
    17
    Par défaut
    Eh bien en fait je ne voit pas bein ou le placer pour qu'il fonctionne correctement : je l'avait mis en dessous de commandbutton1 mais cela ne fait rien : je vous donne mon code peut être aller vious pouvior savoir et m'aider a comprendre pourquoi a cet endroit et pas à un autre
    (je sais il est long mais je decouvre le VBA)

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
     
    'Début du bouton Annulé
    Private Sub CommandButton1_Click()
    For i = 2 To 4
    Controls("TextBox" & i).Value = ""
    Next
    Call EnableControls
    End Sub
    Private Sub CommandButton2_Click()
    For i = 5 To 7
    Controls("TextBox" & i).Value = ""
    Next
    Call EnableControls2
    End Sub
    Private Sub CommandButton3_Click()
    For i = 8 To 10
    Controls("TextBox" & i).Value = ""
    Next
    Call EnableControls3
    End Sub
    Private Sub CommandButton4_Click()
    For i = 11 To 13
    Controls("TextBox" & i).Value = ""
    Next
    Call EnableControls4
    End Sub
    Private Sub CommandButton5_Click()
    For i = 14 To 16
    Controls("TextBox" & i).Value = ""
    Next
    Call EnableControls5
    End Sub
    Private Sub CommandButton6_Click()
    For i = 17 To 19
    Controls("TextBox" & i).Value = ""
    Next
    Call EnableControls6
    End Sub
    Private Sub CommandButton7_Click()
    For i = 20 To 22
    Controls("TextBox" & i).Value = ""
    Next
    Call EnableControls7
    End Sub
    Private Sub CommandButton8_Click()
    For i = 23 To 25
    Controls("TextBox" & i).Value = ""
    Next
    Call EnableControls8
    End Sub
    Private Sub CommandButton9_Click()
    For i = 26 To 28
    Controls("TextBox" & i).Value = ""
    Next
    Call EnableControls9
    End Sub
    Private Sub CommandButton10_Click()
    For i = 29 To 31
    Controls("TextBox" & i).Value = ""
    Next
    Call EnableControls10
    End Sub
    Private Sub CommandButton11_Click()
    For i = 32 To 34
    Controls("TextBox" & i).Value = ""
    Next
    Call EnableControls11
    End Sub
    Private Sub CommandButton12_Click()
    For i = 35 To 37
    Controls("TextBox" & i).Value = ""
    Next
    Call EnableControls12
    End Sub
    Private Sub CommandButton13_Click()
    For i = 38 To 40
    Controls("TextBox" & i).Value = ""
    Next
    Call EnableControls13
    End Sub
     
    Private Sub CommandButton14_Click()
    Call DisableControls
    End Sub
     
    Private Sub DisableControls()
       TextBox2.Enabled = CommandButton14.Value
       TextBox3.Enabled = CommandButton14.Value
       TextBox4.Enabled = CommandButton14.Value
    End Sub
     
    Private Sub CommandButton15_Click()
    Call DisableControls2
    End Sub
     
    Private Sub DisableControls2()
       TextBox5.Enabled = CommandButton15.Value
       TextBox6.Enabled = CommandButton15.Value
       TextBox7.Enabled = CommandButton15.Value
    End Sub
     
    Private Sub CommandButton16_Click()
    Call DisableControls3
    End Sub
     
    Private Sub DisableControls3()
       TextBox8.Enabled = CommandButton16.Value
       TextBox9.Enabled = CommandButton16.Value
       TextBox10.Enabled = CommandButton16.Value
    End Sub
     
    Private Sub CommandButton17_Click()
    Call DisableControls4
    End Sub
     
    Private Sub DisableControls4()
       TextBox11.Enabled = CommandButton17.Value
       TextBox12.Enabled = CommandButton17.Value
       TextBox13.Enabled = CommandButton17.Value
    End Sub
     
    Private Sub CommandButton18_Click()
    Call DisableControls5
    End Sub
     
    Private Sub DisableControls5()
       TextBox14.Enabled = CommandButton18.Value
       TextBox15.Enabled = CommandButton18.Value
       TextBox16.Enabled = CommandButton18.Value
    End Sub
     
    Private Sub CommandButton19_Click()
    Call DisableControls6
    End Sub
     
    Private Sub DisableControls6()
       TextBox17.Enabled = CommandButton19.Value
       TextBox18.Enabled = CommandButton19.Value
       TextBox19.Enabled = CommandButton19.Value
    End Sub
     
    Private Sub CommandButton20_Click()
    Call DisableControls7
    End Sub
     
    Private Sub DisableControls7()
       TextBox20.Enabled = CommandButton20.Value
       TextBox21.Enabled = CommandButton20.Value
       TextBox22.Enabled = CommandButton20.Value
    End Sub
     
    Private Sub CommandButton21_Click()
    Call DisableControls8
    End Sub
     
    Private Sub DisableControls8()
       TextBox23.Enabled = CommandButton21.Value
       TextBox24.Enabled = CommandButton21.Value
       TextBox25.Enabled = CommandButton21.Value
    End Sub
     
    Private Sub CommandButton22_Click()
    Call DisableControls9
    End Sub
     
    Private Sub DisableControls9()
       TextBox26.Enabled = CommandButton22.Value
       TextBox27.Enabled = CommandButton22.Value
       TextBox28.Enabled = CommandButton22.Value
    End Sub
     
    Private Sub CommandButton23_Click()
    Call DisableControls10
    End Sub
     
    Private Sub DisableControls10()
       TextBox29.Enabled = CommandButton23.Value
       TextBox30.Enabled = CommandButton23.Value
       TextBox31.Enabled = CommandButton23.Value
    End Sub
     
    Private Sub CommandButton24_Click()
    Call DisableControls11
    End Sub
     
    Private Sub DisableControls11()
       TextBox32.Enabled = CommandButton24.Value
       TextBox33.Enabled = CommandButton24.Value
       TextBox34.Enabled = CommandButton24.Value
    End Sub
     
    Private Sub CommandButton25_Click()
    Call DisableControls12
    End Sub
     
    Private Sub DisableControls12()
       TextBox35.Enabled = CommandButton25.Value
       TextBox36.Enabled = CommandButton25.Value
       TextBox37.Enabled = CommandButton25.Value
    End Sub
     
    Private Sub CommandButton26_Click()
    Call DisableControls13
    End Sub
     
    Private Sub DisableControls13()
       TextBox38.Enabled = CommandButton26.Value
       TextBox39.Enabled = CommandButton26.Value
       TextBox40.Enabled = CommandButton26.Value
    End Sub 'Fin du bouton Annulé
    'Début du bouton Validé
    Private Sub EnableControls()
       TextBox2.Enabled = CommandButton1.Enabled = True
       TextBox3.Enabled = CommandButton1.Enabled = True
       TextBox4.Enabled = CommandButton1.Enabled = True
    End Sub
     
    Private Sub EnableControls2()
       TextBox5.Enabled = CommandButton2.Enabled = True
       TextBox6.Enabled = CommandButton2.Enabled = True
       TextBox7.Enabled = CommandButton2.Enabled = True
    End Sub
     
    Private Sub EnableControls3()
       TextBox8.Enabled = CommandButton3.Enabled = True
       TextBox9.Enabled = CommandButton3.Enabled = True
       TextBox10.Enabled = CommandButton3.Enabled = True
    End Sub
     
    Private Sub EnableControls4()
       TextBox11.Enabled = CommandButton4.Enabled = True
       TextBox12.Enabled = CommandButton4.Enabled = True
       TextBox13.Enabled = CommandButton4.Enabled = True
    End Sub
     
    Private Sub EnableControls5()
       TextBox14.Enabled = CommandButton5.Enabled = True
       TextBox15.Enabled = CommandButton5.Enabled = True
       TextBox16.Enabled = CommandButton5.Enabled = True
    End Sub
     
    Private Sub EnableControls6()
       TextBox17.Enabled = CommandButton6.Enabled = True
       TextBox18.Enabled = CommandButton6.Enabled = True
       TextBox19.Enabled = CommandButton6.Enabled = True
    End Sub
     
    Private Sub EnableControls7()
       TextBox20.Enabled = CommandButton7.Enabled = True
       TextBox21.Enabled = CommandButton7.Enabled = True
       TextBox22.Enabled = CommandButton7.Enabled = True
    End Sub
     
    Private Sub EnableControls8()
       TextBox23.Enabled = CommandButton8.Enabled = True
       TextBox24.Enabled = CommandButton8.Enabled = True
       TextBox25.Enabled = CommandButton8.Enabled = True
    End Sub
     
    Private Sub EnableControls9()
       TextBox26.Enabled = CommandButton9.Enabled = True
       TextBox27.Enabled = CommandButton9.Enabled = True
       TextBox28.Enabled = CommandButton9.Enabled = True
    End Sub
     
    Private Sub EnableControls10()
       TextBox29.Enabled = CommandButton10.Enabled = True
       TextBox30.Enabled = CommandButton10.Enabled = True
       TextBox31.Enabled = CommandButton10.Enabled = True
    End Sub
     
    Private Sub EnableControls11()
       TextBox32.Enabled = CommandButton11.Enabled = True
       TextBox33.Enabled = CommandButton11.Enabled = True
       TextBox34.Enabled = CommandButton11.Enabled = True
    End Sub
     
    Private Sub EnableControls12()
       TextBox35.Enabled = CommandButton12.Enabled = True
       TextBox36.Enabled = CommandButton12.Enabled = True
       TextBox37.Enabled = CommandButton12.Enabled = True
    End Sub
     
    Private Sub EnableControls13()
       TextBox38.Enabled = CommandButton13.Enabled = True
       TextBox39.Enabled = CommandButton13.Enabled = True
       TextBox40.Enabled = CommandButton13.Enabled = True
    End Sub 'Fin du bouton Validé
    'Début du bouton Edition
    Private Sub CommandButton27_Click()
    Call EnableControls14
    End Sub
     
    Private Sub EnableControls14()
       TextBox2.Enabled = CommandButton27.Enabled = True
       TextBox3.Enabled = CommandButton27.Enabled = True
       TextBox4.Enabled = CommandButton27.Enabled = True
    End Sub
     
    Private Sub CommandButton28_Click()
    Call EnableControls15
    End Sub
     
    Private Sub EnableControls15()
       TextBox5.Enabled = CommandButton28.Enabled = True
       TextBox6.Enabled = CommandButton28.Enabled = True
       TextBox7.Enabled = CommandButton28.Enabled = True
    End Sub
     
    Private Sub CommandButton29_Click()
    Call EnableControls16
    End Sub
     
    Private Sub EnableControls16()
       TextBox8.Enabled = CommandButton29.Enabled = True
       TextBox9.Enabled = CommandButton29.Enabled = True
       TextBox10.Enabled = CommandButton29.Enabled = True
    End Sub
     
    Private Sub CommandButton30_Click()
    Call EnableControls17
    End Sub
     
    Private Sub EnableControls17()
       TextBox11.Enabled = CommandButton30.Enabled = True
       TextBox12.Enabled = CommandButton30.Enabled = True
       TextBox13.Enabled = CommandButton30.Enabled = True
    End Sub
     
    Private Sub CommandButton31_Click()
    Call EnableControls18
    End Sub
     
    Private Sub EnableControls18()
       TextBox14.Enabled = CommandButton31.Enabled = True
       TextBox15.Enabled = CommandButton31.Enabled = True
       TextBox16.Enabled = CommandButton31.Enabled = True
    End Sub
     
    Private Sub CommandButton32_Click()
    Call EnableControls19
    End Sub
     
    Private Sub EnableControls19()
       TextBox17.Enabled = CommandButton32.Enabled = True
       TextBox18.Enabled = CommandButton32.Enabled = True
       TextBox19.Enabled = CommandButton32.Enabled = True
    End Sub
     
    Private Sub CommandButton33_Click()
    Call EnableControls20
    End Sub
     
    Private Sub EnableControls20()
       TextBox20.Enabled = CommandButton33.Enabled = True
       TextBox21.Enabled = CommandButton33.Enabled = True
       TextBox22.Enabled = CommandButton33.Enabled = True
    End Sub
     
    Private Sub CommandButton34_Click()
    Call EnableControls21
    End Sub
     
    Private Sub EnableControls21()
       TextBox23.Enabled = CommandButton34.Enabled = True
       TextBox24.Enabled = CommandButton34.Enabled = True
       TextBox25.Enabled = CommandButton34.Enabled = True
    End Sub
     
    Private Sub CommandButton35_Click()
    Call EnableControls22
    End Sub
     
    Private Sub EnableControls22()
       TextBox26.Enabled = CommandButton35.Enabled = True
       TextBox27.Enabled = CommandButton35.Enabled = True
       TextBox28.Enabled = CommandButton35.Enabled = True
    End Sub
     
    Private Sub CommandButton36_Click()
    Call EnableControls23
    End Sub
     
    Private Sub EnableControls23()
       TextBox29.Enabled = CommandButton36.Enabled = True
       TextBox30.Enabled = CommandButton36.Enabled = True
       TextBox31.Enabled = CommandButton36.Enabled = True
    End Sub
     
    Private Sub CommandButton37_Click()
    Call EnableControls24
    End Sub
     
    Private Sub EnableControls24()
       TextBox32.Enabled = CommandButton37.Enabled = True
       TextBox33.Enabled = CommandButton37.Enabled = True
       TextBox34.Enabled = CommandButton37.Enabled = True
    End Sub
     
    Private Sub CommandButton38_Click()
    Call EnableControls25
    End Sub
     
    Private Sub EnableControls25()
       TextBox35.Enabled = CommandButton38.Enabled = True
       TextBox36.Enabled = CommandButton38.Enabled = True
       TextBox37.Enabled = CommandButton38.Enabled = True
    End Sub
     
    Private Sub CommandButton39_Click()
    Call EnableControls26
    End Sub
     
    Private Sub EnableControls26()
       TextBox38.Enabled = CommandButton39.Enabled = True
       TextBox39.Enabled = CommandButton39.Enabled = True
       TextBox40.Enabled = CommandButton39.Enabled = True
    End Sub 'Fin du bouton Edition

  7. #7
    Membre chevronné Avatar de Krovax
    Profil pro
    Inscrit en
    Juillet 2008
    Messages
    1 888
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 888
    Points : 2 168
    Points
    2 168
    Par défaut
    Ouais on va rester sur un exemple simple.
    Mais a mon avis tu fait vraiment des truc bizard tu pourrais m'expliquer pourquoi tu fais

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    TextBox2.Enabled = CommandButton14.Value
    car visiblement (du moins sur ce que j'ai pu voir c'est toujours faux alors autant mettre
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    TextBox2.Enabled = False
    De plus tu peux m'expliquer ce que tu veux faire en faisant

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    TextBox38.Enabled = CommandButton39.Enabled = True
    car cela revient a faire
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    TextBox38.Enabled = CommandButton39.Enabled

    Maintenant est ce que tu as testé Locked pour les texte box au lieu de enabled?
    pour la couleur on est d'accord que c'est au moment ou tu met enable a false que tu veux modifier la couleur alors essaye d'insérer le code juste après

  8. #8
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2009
    Messages
    38
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2009
    Messages : 38
    Points : 17
    Points
    17
    Par défaut
    génial sa fonctionne : j'ai l'ai mis ici :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
    Private Sub DisableControls()
       TextBox2.Locked = True
       TextBox2.ForeColor = RGB(255, 0, 0)
       TextBox3.Enabled = False
       TextBox4.Enabled = False
    End Sub
    (j'ai fait un test avec textbox2 seulement : je vais tout changer dans mon code... hihihi)

    un grand merci
    mais existe il une palette qui liste les code avec leur couleur ???

    PS saurait tu faire le texte defilent car dans la fake : la siolution que l'on m'a trouvé ne focntionne pas

  9. #9
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2009
    Messages
    38
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2009
    Messages : 38
    Points : 17
    Points
    17
    Par défaut
    finalement je vais pas utiliser textbox = loked car le but est de pouvoir editer le texte en revanche si tu fait loked : je constate que tu ne peut plus revenir dans la case !!!

  10. #10
    Inactif  
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    2 054
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Juin 2007
    Messages : 2 054
    Points : 2 416
    Points
    2 416
    Par défaut
    Bonjour tous,
    Un exemple de texte qui défile mais comme dit plus haut, c'est assez lourd à gérer.
    A+

  11. #11
    Membre chevronné Avatar de Krovax
    Profil pro
    Inscrit en
    Juillet 2008
    Messages
    1 888
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 888
    Points : 2 168
    Points
    2 168
    Par défaut
    il te suffit de mettre le locke a false pour autoriser l'édition.
    Je ne vois pas ce que cela change par rapport au enable. Quand enable est a faux tu ne pas pas éditer le text box

    Pour la palette de couleur c'est la pallette RGB classique, je te laisse consulter internet pour l'avoir ou plus simple sous paint tu utilise la pipette (prélèvement de couleur) pour avoir la couleur qui t'intéresse tu va dans le menue couleur/modifier les couleur, définir les couleur personnaliser et tu regarde les valeur Rouge, vert et bleu (RedGreenBlue)

    par contre tu n'as répondu a aucune de mes questions concernant les ligne de code, du coup je ne répondu plus au tienne na

    ps : un fake est un truc faux une FAQ est une Foire Aux Questions

  12. #12
    Rédacteur/Modérateur

    Avatar de Jean-Philippe André
    Homme Profil pro
    Architecte Power Platform, ex-Développeur VBA/C#/VB.Net
    Inscrit en
    Juillet 2007
    Messages
    14 656
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : Canada

    Informations professionnelles :
    Activité : Architecte Power Platform, ex-Développeur VBA/C#/VB.Net
    Secteur : Finance

    Informations forums :
    Inscription : Juillet 2007
    Messages : 14 656
    Points : 34 369
    Points
    34 369
    Par défaut
    Concernant les couleurs, tu as ce très bon outil de SilkyRoad
    http://silkyroad.developpez.com/VBA/...CodesCouleurs/

  13. #13
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2009
    Messages
    38
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2009
    Messages : 38
    Points : 17
    Points
    17
    Par défaut
    désolé, je me suis réjoui trop vite dès que j'insere
    TextBox2.ForeColor = RGB(255, 0, 0)
    cela ne focntionne pas : ca marche pour le bouton "editer" mais avec le bouton validé (commandbutton14) le texte reste gris
    Classeur1.zip

  14. #14
    Membre chevronné Avatar de Krovax
    Profil pro
    Inscrit en
    Juillet 2008
    Messages
    1 888
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 888
    Points : 2 168
    Points
    2 168
    Par défaut
    Bon comme je l'ai dis avant enabled met le texte en gris la couleur ne fonctionne que si tu utilise locked

    Voila pour les 3 premiers.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    Private Sub DisableControls()
       TextBox2.Locked = True
       TextBox2.ForeColor = RGB(255, 0, 0)
       TextBox3.Locked = True
       TextBox3.ForeColor = RGB(255, 0, 0)
       TextBox4.Locked = True
       TextBox4.ForeColor = RGB(255, 0, 0)
    End Sub
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     
    Private Sub EnableControls14()
       TextBox2.Locked = False
       TextBox2.ForeColor = RGB(0, 0, 0)
       TextBox3.Locked = False
       TextBox3.ForeColor = RGB(0, 0, 0)
       TextBox4.Locked = False
       TextBox4.ForeColor = RGB(0, 0, 0)
    End Sub
    Après il y a moyen de simplifier le code mais la pas le temps juste une chose


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    Private Sub CommandButton27_Click()
    Call EnableControls14
    End Sub
     
    Private Sub EnableControls14()
       TextBox2.Locked = False
       TextBox2.ForeColor = RGB(0, 0, 0)
       TextBox3.Locked = False
       TextBox3.ForeColor = RGB(0, 0, 0)
       TextBox4.Locked = False
       TextBox4.ForeColor = RGB(0, 0, 0)
    End Sub
    Autant directement mettre

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    Private Sub CommandButton27_Click()
       TextBox2.Locked = False
       TextBox2.ForeColor = RGB(0, 0, 0)
       TextBox3.Locked = False
       TextBox3.ForeColor = RGB(0, 0, 0)
       TextBox4.Locked = False
       TextBox4.ForeColor = RGB(0, 0, 0)
    End Sub
    pas la peine de passer par une sous procédure qui si j'ai bien vu ne sera appelé qu'une seule fois

  15. #15
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2009
    Messages
    38
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2009
    Messages : 38
    Points : 17
    Points
    17
    Par défaut
    merci tout focntionne a merveille

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [XL-2010] Formule pour texte defilant dans un webbrowser
    Par Seuche dans le forum Macros et VBA Excel
    Réponses: 4
    Dernier message: 22/03/2015, 13h13
  2. Texte defilant dans mon site web
    Par killer_instinct dans le forum Balisage (X)HTML et validation W3C
    Réponses: 4
    Dernier message: 16/04/2007, 19h58
  3. Texte Defilant dans la barre
    Par franck.automaticien dans le forum Général JavaScript
    Réponses: 4
    Dernier message: 20/06/2006, 09h24
  4. VB6] imprimer le texte afficher dans une picturebox
    Par Persons dans le forum VB 6 et antérieur
    Réponses: 2
    Dernier message: 27/08/2004, 11h15
  5. Réponses: 6
    Dernier message: 21/06/2002, 14h48

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo