| new topic post reply | Tech Patterns Forum Index ==> Consumer Software :: Graphics, Utilities, Office, Media |
| Back to top |
I have 2700 Word documents in which the AutoOpen macro fails. I do not want to have to open each document by hand and manually delete the AutoOpen macro.
So, I need to create a script that can be run from the command line to open Word documents from a folder and delete the AutoOpen macro from each document. I have the code below so far, but one problem is opening the document fires the AutoOpen. Can this be prevented? I've seen the switch /m to stop the macros from running on open, but it doesn't work in the script on the .Open statement. The second problem is: Are there functions that can be used in the script to delete the AutoOpen macro? Thanks for any help you can offer. _____________________________________________ Set objWord = CreateObject("Word.Application") objWord.Visible = True Set FSO = CreateObject("Scripting.FileSystemObject") DoDir FSO.GetFolder(".") Sub DoDir(Folder) On Error Resume Next Dim File For Each File In Folder.Files Set objDoc = objWord.Documents.Open(File.Path /m) rem objDoc.DeleteMacro("AutoOpen") objDoc.Save() objDoc.Close() Next End Sub objWord.Quit() |
|
techAdmin
Back to top
Status: Site Admin Joined: 26 Sep 2003 Posts: 848 Location: East Coast, West Coast? I know it's one of them. |
We don't offer MS word macro support here, sorry.
If someone comes along with an answer though, that's of course fine. |
|
All times are GMT - 8 Hours |
|
Contact Us
Hosting: Pair Networks: 0.043
Forum Software © 2001–2006 phpBB
techForum Style © 2003–2006 techpatterns.com
info
Hosting: Pair Networks: 0.043
Forum Software © 2001–2006 phpBB
techForum Style © 2003–2006 techpatterns.com
info