The information in this article applies to:
SYMPTOMSWhen you copy an object that has a macro assigned to it, the macro is not copied with the object. For example, if Sheet1 contains a button with a macro named Test assigned to the button, and you copy the button from Sheet1 to Sheet2, the macro does not run when you click the button on Sheet2. When you right-click the button on Sheet2 and click Assign Macro, a new macro named Button1_Click is now assigned. CAUSEThis problem occurs when you copy anything to the Office Clipboard after you copy the object, and then use the Office Clipboard to paste the object. WORKAROUNDTo work around this problem, when copying and pasting objects that have macros assigned to them, immediately paste using the Paste command on the Edit menu (or press CTRL+V) instead of using the Office Clipboard. STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. MORE INFORMATIONYou can use either the Forms toolbar or the Drawing toolbar to draw an object on the worksheet. To run a macro when you click the object, you can right-click the object, click Assign Macro, and choose a macro to run when you click the object. However, when you copy an object that has a macro assigned to it, the macro may not be copied with the object and a new undefined macro may be assigned when you paste the object using the Office Clipboard. The new macro name is based on the Click event for that object and the type of object. For example, if you draw an AutoShape object, the new macro name assigned to the copied object is AutoShape1_Click. If the object is a button, the new macro name assigned to the copied object is Button1_Click. To ensure that the correct macro is retained when you copy an object, use the Paste command on the Edit menu or Standard toolbar to paste an object instead of the Paste command on the Office Clipboard. Additional query words: XL2000
Keywords : xlvbainfo xldraw |
Last Reviewed: November 24, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |