#  Other Applications & Softwares  > PowerPoint Formatting & General >  > [SOLVED] create and then delete a shape.  Probably simple problem.

## dareeldill

This is probably a simple problem but I just can't figure it out.  Any help is appreciated.

I have 1 page. on the page I have a button that runs the "create" macro.  Create macro will create a button named "player" that runs the "Test" macro.   The test macro should delete the button named "player" but I just can't get it to work and I'm not sure why.  See my code below.





```
Please Login or Register  to view this content.
```

----------


## kev_

IMPORTANT 
- please edit your post and put your code in code tags 
- this is done by selecting the text and clicking on the # icon above
thanks

The line



```
Please Login or Register  to view this content.
```


runs VBA "test"

----------


## dareeldill

Ok I have updated it.

thanks for that information.

I'm not quite sure what you mean about the call test code.  The first sub doesn't actually call the "test" sub.   It assigns the "test" sub to the new shape that is created.

I need the test code to be applied to the second button, the one created by the first button.  

So press 1 button and a second appears.  press the second button and the 2nd button disappears.

Thanks.

----------


## kev_

you have a typo 

Instead of:



```
Please Login or Register  to view this content.
```


Use:



```
Please Login or Register  to view this content.
```

----------


## dareeldill

Kevin you are a genius.  And I am an idiot.  I've been overlooking this for 2 days.  I thoroughly appreciate your help.  You solved it.

----------


## kev_

You could reduce the risk of this type of problem

Declare your variable "button" at the top of the module (ie above all the Subs) - see below
This makes "button" available to all procedures in the module
Sub "test" is now easier to type!   :Smilie: 




```
Please Login or Register  to view this content.
```

----------


## dareeldill

Hey! Not a bad idea at all.  Thank you very much.  I'll have to take advantage of this in the future.  

Thanks again.

----------

