+ Reply to Thread
Results 1 to 3 of 3

Delete calling macro button by VBA

  1. #1
    Forum Contributor
    Join Date
    11-14-2007
    Posts
    142

    Delete calling macro button by VBA

    Hi

    I have a VBA macro in a workbook which is invoked by clicking on a command button in a worksheet.

    It is intended that the macro only ever be invoked once in the workbook. (Basically, the user puts some initialising data into a separate dedicated worksheet in the template workbook, runs the macro which does various things one-off with the initialising data, then deletes the worksheet containing that data.)

    The macro already contains code which prevents its execution twice, but to tidy up the workbook I would also quite like it if the command button used to invoke it is also deleted from the workbook at the conclusion of the first execution of the macro. Can someone please give me guidance on that instruction?

    Thanks.
    Last edited by 1eyedjack; 05-20-2010 at 04:59 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Delete calling macro button by VBA

    All rather depends on the nature of the control used - is the button an Active X button or a Forms button ? On which sheet does it reside ?

    Active X (ie using Click Event)

    Please Login or Register  to view this content.
    Forms Control (ie macro "assigned")

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    11-14-2007
    Posts
    142

    Re: Delete calling macro button by VBA

    Yup that did it, thanks

    I was using the forms toolbar, not ActiveX.

    I take the simplistic view of not using ActiveX provided that the alternative works. Maybe that is the wrong attitude. I gather that you get more power over what you can do if within ActiveX, but if you don't need it ....

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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