VBA et Annuler Dernière Opération

  • Initiateur de la discussion schmail
  • Date de début
S

schmail

Guest
Bonjour le Forum

Je souhaiterais inclure dans une USF un CommandButton "Annuler la dernière opération". Je n'ai rien trouver ni sur ce forum ni sur MPFE et l'enregistreur de macro a décidé de m'ignorer.... Y-a-t'il une soluce ou faut il passé (Si c'est possible!!!) par une simulation d'entrée clavier "Ctrl+Z" ??

Bonne Fin de Matinée à Toutes et Tous
 
S

schmail

Guest
Salut Eric

J'ai essayé "onundo" mais cette instruction oblige à repasser par le menu edition de Xl (ce que je voulais éviter....). Je voulais en fait que mon CommandButton exécute lui même l'annulation.

Merci et @+
 
@

@+Thierry

Guest
Bonjour Eric et Schmail

Je pense qu'il y a confusion dans ce Fil.

Schmail voudrait un Undo Button dans son UserForm... (Donc Undo d'un macro, si j'ai compris...)

Eric propose, semble-t'il, Application.Undo qui n'est pas applicable d'après ce que j'ai dans l'aide (sorry je suis travaille en US "It cannot be used to undo Visual Basic commands")

Non l'exemple dont parles Eric c'est plutot à UndoAction que Schmail devrait s'orienter...

Voici ce que dis mon aide :

The Undo command in the user interface uses the UndoAction method. For example, if you paste text into a TextBox, you can use UndoAction to remove that text and restore the previous contents of the TextBox.

Not all user actions can be undone. If an action cannot be undone, the Undo command is unavailable following the action.

Note If the CanUndo property is False, the Undo command is not available in the user interface, and UndoAction is not valid in code.

If UndoAction is applied to a form, all changes to the current record are lost. If UndoAction is applied to a control, only the control itself is affected.

You must apply this method before the form or control is updated. You may want to include this method in a form's BeforeUpdate event or a control's Change event.

UndoAction is an alternative to using the SendKeys Statement to send the value of ESC in an event procedure.


Pour le SendKey Echappe ==> Sendkey SendKeys "{ESC}"

Bon Appétit.
@+Thierry
 
S

schmail

Guest
Bonsoir tout le monde

Finalement j'étais resté bloqué sur redoaction et je ne voyais pas bien où cela pouvait me mener mais en tapant undoaction j'ai retrouvé l'aide de Thierry en français. Bien comme dirait Ti j'ai cru qu'XL allait me faire le café...
je vais contourner le Pb avec une MsgBox d'avertissement avant l'exécution de la macro

Merci à tous et Bonne soirée
 

Discussions similaires

Statistiques des forums

Discussions
314 092
Messages
2 105 731
Membres
109 420
dernier inscrit
raphael19