+ Reply to Thread
Results 1 to 7 of 7

create and then delete a shape. Probably simple problem.

  1. #1
    Forum Contributor
    Join Date
    07-01-2017
    Location
    Las Vegas, NV
    MS-Off Ver
    Office 2013
    Posts
    132

    create and then delete a shape. Probably simple problem.

    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.
    Last edited by dareeldill; 07-02-2017 at 06:17 AM.

  2. #2
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: create and then delete a shape. Probably simple problem.

    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"
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  3. #3
    Forum Contributor
    Join Date
    07-01-2017
    Location
    Las Vegas, NV
    MS-Off Ver
    Office 2013
    Posts
    132

    Re: create and then delete a shape. Probably simple problem.

    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.
    Last edited by dareeldill; 07-02-2017 at 07:01 AM.

  4. #4
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: create and then delete a shape. Probably simple problem.

    you have a typo

    Instead of:
    Please Login or Register  to view this content.
    Use:
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    07-01-2017
    Location
    Las Vegas, NV
    MS-Off Ver
    Office 2013
    Posts
    132

    Re: create and then delete a shape. Probably simple problem.

    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.

  6. #6
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: create and then delete a shape. Probably simple problem.

    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!

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    07-01-2017
    Location
    Las Vegas, NV
    MS-Off Ver
    Office 2013
    Posts
    132

    Re: create and then delete a shape. Probably simple problem.

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

    Thanks again.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] delete shape
    By chief_abound in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-18-2015, 01:56 AM
  2. Simple VBA for cell shape to display image DRIVING ME MAD
    By Muzza86 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-06-2014, 10:26 AM
  3. Delete a shape with a button push
    By jeff_kaufman in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-02-2013, 02:20 PM
  4. "PICOBJ.DELETE" to remove shape: Problem when validation list populated
    By bubastisbastet in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-01-2010, 05:04 PM
  5. Delete Shape and Row
    By eblaze in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-19-2010, 04:53 PM
  6. delete shape that has same shape name a cell
    By beatrice25 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-16-2009, 03:05 AM
  7. [SOLVED] Why can't I delete this shape now?
    By JK in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-22-2005, 01:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1