DocumentRemoveMacros Method

Removes all macros (the VBA project) as well as toolbars and command customizations from the document.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.7.0

Syntax

public void RemoveMacros()

Remarks

By removing all macros from a document you can ensure the document contains no macro viruses.

Examples

Shows how to remove all macros from a document.
// Open a document that contains a VBA project and macros
Document doc = new Document(MyDir + "Macro.docm");

Assert.IsTrue(doc.HasMacros);

// We can strip the document of this content by calling this method
doc.RemoveMacros();

Assert.IsFalse(doc.HasMacros);

See Also