Problème pour lancer une macro-commande à partir d'un bouton
J'ai un bouton pour lancer une macro.
La 1ere partie:
Code:
1 2 3 4 5 6
|
Sub creation_projet_Click()
Application.Run "'Estimations.xlsm'!projet_new"
indexation.Show
End Sub |
fonctionne à merveille.
Maintenant, le code pour le formulaire "indexation":
Code:
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
|
Option Explicit
Private Sub CommandButton1_Click()
Call UserForm_Initialize
End Sub
Private Sub OK_Click()
Sheets("nouveau projet").Activate
Cells.Item(1, 1) = nom_projet.Text
Cells.Item(5, 2) = no_projet.Text
Cells.Item(1, 4) = client.Text
Cells.Item(1, 10) = adresse.Text
Cells.Item(2, 10) = ville.Text
Cells.Item(3, 10) = code_postal.Text
Cells.Item(4, 10) = tel.Text
Cells.Item(5, 10) = telec.Text
Cells.Item(6, 10) = email.Text
If OptionReservoir Then Cells.Item(7, 2) = "Réservoir"
If OptionPF Then Cells.Item(7, 2) = "Plate-forme"
If OptionPFA Then Cells.Item(7, 2) = "Plate-forme et abri"
Range("C10").Activate
Application.Run "'Estimations.xlsm'!indexation"
Unload Me
End Sub
Private Sub Cancel_Click()
Unload Me
End Sub |
refuse maintenant de lancer la macro "indexation". Je ne comprends pas, tout fonctionnaire en début de semaine...
Le code du bouton est situé dans "MS Excel Objects", le code du formulaire dans "indexation", et les macros dans différents modules, tous rattachés au même fichier, Estimation (Estimations.xlsm).
Est-ce parce que j'ai un formulaire du même nom qu'une macro?