I have a large number of documents that have a digitally signed macro
in them. I am attempting to mass-delete this macro from the
documents. I created a VB Script which searches the given directory,
instantiates a Word Object and opens each file one at a time.
How do I delete a macro if I have a Word.Document Object and I know the
name of the macro?
My current VBCode is attached.
Thanks in advance for any help.
-Jim
-------------------Begin Included VB Script-----------------
'Set Type of Files To Act Upon
DocumentType="Microsoft Word Document"
'Generate Objects for Filesystem, Folder, and Files within the current
folder
Set FileSysObj = CreateObject("Scripting.FileSystemObject")
Set FileSysFolder =
FileSysObj.GetFolder(FileSysObj.GetAbsolutePathName("."))
Set FileSysFiles = FileSysFolder.Files
Set Word = CreateObject("Word.Application")
Word.Visible = True
'Loop through each File In the Folder
For Each ObjFile in FileSysFiles
If (objFile.Type = DocumentType) Then
Doc_Name = FileSysFolder & "\" & objFile.Name
Word.Documents.Open(Doc_Name)
'INSERT CODE TO DELETE MACRO AutoOpen
Word.Documents(Doc_Name).Save()
Word.Documents(Doc_Name).Close()
End If
Next
Word.Quit
--------------------End Included VB Script
------------------------------------
Charles Kenyon - 13 Feb 2006 21:54 GMT
You need to know the name of the macro and the module to be very effective.
Otherwise, you are going to have to cycle through them with your code. Note
that even if you remove the macro, the document will trigger macro warnings
from security.

Signature
Charles Kenyon
Word New User FAQ & Web Directory: http://addbalance.com/word
Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide
See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
>I have a large number of documents that have a digitally signed macro
> in them. I am attempting to mass-delete this macro from the
[quoted text clipped - 40 lines]
> --------------------End Included VB Script
> ------------------------------------