Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Oklahoma, Oklahoma, USA
    Posts
    134
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macro to delete Macro (Word2000/SR1a & SP2)

    We have someone that needs a macro that will delete a macro; she runs a program that writes a temporary macro that is deleted once the process runs through; however, she sometimes crashes and then the temporary macro has to be manually deleted. She wants a toolbar button to accomplish this and for the life of me, I don't know how to write a macro to delete another macro. Any help out there on this would be greatly appreciated.

  2. #2
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Macro to delete Macro (Word2000/SR1a & SP2)

    The information and code that you need is on Chip Pearson's site. --Sam
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  3. #3
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Oklahoma, Oklahoma, USA
    Posts
    134
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro to delete Macro (Word2000/SR1a & SP2)

    Sammy, that all pertained to Excel Workbooks; I need to delete a Word macro.

  4. #4
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Macro to delete Macro (Word2000/SR1a & SP2)

    But I don't think that matters: you're just using the IDE not anything in the Excel object model. Try it, I think it will work (but I've not tried it myself).
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  5. #5
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Macro to delete Macro (Word2000/SR1a & SP2)

    Perhaps changing ThisWorkbook to ThisDocument is all that would be required. That and setting a reference to the VBA Extensibility library.

    If you are okay with deleting an entire module, rather than an individual macro in a module, you can use this one-liner:

    Application.OrganizerDelete Source:=NormalTemplate, _
    Name:="Module1", Object:=wdOrganizerObjectProjectItems

    It ruthlessly removes modules without any backup.

Posting Permissions

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