How to delete winword macros attaches to documents

Posted on 2008-11-04
Last Modified: 2012-05-05
I have a problem with some winword documents that have some macros attaches to the documents. Thes macros are in conflict with macros of the I Have a lot of doc files to verify.
Do you know if it's possible to write a VBA macro to open all then winword documents and to delete all macros attached to the documents ?

Question by:CBADET
    LVL 76

    Expert Comment

    First of all, are you sure that the macros are in the document?  The usual way for Word to work is to have the macros in a Template. When a document created from the Template, the macros are not transferred to the document, but are available because the template is attached , so changing the attached template to Normal will break the link.
    LVL 76

    Accepted Solution

    If the code is in the document, you can delete it with the OrganizerDelete method
        Application.OrganizerDelete "C:\MyFolder\MyFile.doc", "Module1", wdOrganizerObjectProjectItems

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Article by: Martin
    Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
    This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now