![]() |
|
|
|
#1
|
||||
|
||||
|
The following macro will unlink all fields and delete metadata in all documents in a selected folder:
Code:
Sub UpdateDocuments()
Application.ScreenUpdating = False
Dim strFolder As String, strFile As String, strDocNm As String, wdDoc As Document
strDocNm = ActiveDocument.FullName
strFolder = GetFolder
If strFolder = "" Then Exit Sub
strFile = Dir(strFolder & "\*.doc")
While strFile <> ""
If strFolder & "\" & strFile <> strDocNm Then
Set wdDoc = Documents.Open(FileName:=strFolder & "\" & strFile, AddToRecentFiles:=False, Visible:=False)
With wdDoc
.Fields.Unlink
.RemoveDocumentInformation (wdRDIAll)
.Close SaveChanges:=True
End With
End If
strFile = Dir()
Wend
Set wdDoc = Nothing
Application.ScreenUpdating = True
End Sub
Function GetFolder() As String
Dim oFolder As Object
GetFolder = ""
Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path
Set oFolder = Nothing
End Function
For Mac macro installation & usage instructions, see: http://word.mvps.org/Mac/InstallMacro.html
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#2
|
|||
|
|||
|
Wow. Thank you so much. I really appreciate it! I'll give it a try in a bit.
|
|
#3
|
|||
|
|||
|
This worked great! I'm much obliged! Thank you!
![]() Is there a way to give credit/kudos/thanks to the people who help me on this forum? Thanks! ETA: Found the reputation scales.
|
|
#4
|
||||
|
||||
|
There are two ways:
a) letting others know how much you appreciate the help given; and b) using the reputation tools, which I see you've found (thanks).
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#5
|
|||
|
|||
|
This macro works great on .doc files, but I have .html files to work on. I tried changing the following line with .doc to .html
It worked but created a new folder for each file with the following files in that folder: colorschememapping.xml filelist.xml themedata.xml and then save each file as a .doc in the folder where the .hyml files were located Also found that a closed parenthesis was needed at the end of (wdRDIALL Can anyone be of some help here? I am running Word 2010 in Bootcamp on a MAC for now, having issues with the MAC keyboard, so switched over to Bootcamp. Thanks a lot for the macro and Kudos to Paul Edstein for creating the macro. |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Hyperlinks: Removing Underline
|
reRanger | Word | 2 | 08-04-2016 02:29 AM |
Protected Document: Multiple Hyperlinks
|
Andrew H | Word VBA | 7 | 11-26-2012 01:08 PM |
remove multiple hyperlinks
|
jwallace113 | Word | 5 | 03-31-2012 05:48 AM |
| Insert Multiple hyperlinks to word repeated in doc - easily | synses | Word | 8 | 02-24-2012 05:17 AM |
| Hyperlinks in locked documents? | Chris_S | Word | 0 | 01-26-2010 11:58 AM |