[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


How to delete winword macros attaches to documents

Posted on 2008-11-04
Medium Priority
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 normal.dot. 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
  • 2
LVL 76

Expert Comment

ID: 22875629
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

GrahamSkan earned 1000 total points
ID: 22875657
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


Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

872 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