Deleting a Macro from a VBS Script

J

Jim

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
------------------------------------
 
C

Charles Kenyon

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.
--
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


--------- --------- --------- --------- --------- ---------
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top