Microsoft KB Archive/215589

= XL2000: Assigned Macro Not Copied with Objects =

Article ID: 215589

Article Last Modified on 10/7/2003

-

APPLIES TO


 * Microsoft Excel 2000 Standard Edition

-



This article was previously published under Q215589



SYMPTOMS
When 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.



CAUSE
This 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.



WORKAROUND
To 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.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.



MORE INFORMATION
You 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: kbbug kbpending KB215589

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.