Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-04-2012, 09:01 AM
konopca konopca is offline Remove title property from all files in a folder Windows XP Remove title property from all files in a folder Office 2003
Novice
Remove title property from all files in a folder
 
Join Date: Apr 2011
Posts: 27
konopca is on a distinguished road
Default Remove title property from all files in a folder

I am unsure how to edit this code so that it removes the title property from all files in a folder.



Code:
Sub Anonymizer()
Application.ScreenUpdating = False
Dim strInFold As String, strOutFold As String, strFile As String, strOutFile As String, DocSrc As Document
'Call the GetFolder Function to determine the folder to process
strInFold = GetFolder
If strInFold = "" Then Exit Sub
strFile = Dir(strInFold & "\*.doc", vbNormal)
'Check for documents in the folder - exit if none found
If strFile <> "" Then strOutFold = strInFold & "\Output\"
'Test for an existing outpfolder & create one if it doesn't already exist
If Dir(strOutFold, vbDirectory) = "" Then MkDir strOutFold
strFile = Dir(strInFold & "\*.doc", vbNormal)
'Process all documents in the chosen folder
While strFile <> ""
  Set DocSrc = Documents.Open(FileName:=strInFold & "\" & strFile, AddTorecentFiles:=False, Visible:=False)
  With DocSrc
    'remove personal information
    .RemoveDocumentInformation (wdRDIDocumentProperties)
    'String variable for the output filenames
    strOutFile = strOutFold & Split(.Name, ".")(0)
    'Save and close the document
    .SaveAs FileName:=strOutFile
    .Close
  End With
  strFile = Dir()
Wend
Set Rng = Nothing: Set DocSrc = Nothing
Application.ScreenUpdating = True
End Sub

Function GetFolder(Optional Title As String, Optional RootFolder As Variant) As String
On Error Resume Next
GetFolder = CreateObject("Shell.Application").BrowseForFolder(0, Title, 0, RootFolder).Items.Item.Path
End Function
Reply With Quote
  #2  
Old 12-04-2012, 10:09 AM
gmaxey gmaxey is offline Remove title property from all files in a folder Windows 7 32bit Remove title property from all files in a folder Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

I already does. It puts the new files (stripped of data) in the Output sub-folder of the folder you selected. The original files are preserved. You can delete them if you want.
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #3  
Old 12-04-2012, 10:54 AM
konopca konopca is offline Remove title property from all files in a folder Windows XP Remove title property from all files in a folder Office 2003
Novice
Remove title property from all files in a folder
 
Join Date: Apr 2011
Posts: 27
konopca is on a distinguished road
Default

Yes it does. I swear it did not worked earlier. Maybe because I stopped it before it finished. It was processing 200+ documents; it was taking a while.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove title property from all files in a folder Move files from one folder to another obasanla Word 1 09-28-2012 04:42 PM
outlook 2003 always not remove temp copy of opened attachments in temporary folder c.itech Outlook 0 06-20-2011 10:34 PM
Remove title property from all files in a folder Outlook 2007: how to remove RSS folder minkowski Outlook 2 04-24-2011 11:25 PM
Cannot remove replaced personal folder rumin Outlook 2 01-31-2011 08:28 AM
Adding a field to a folder of PDF files. Balliol Windows 0 11-22-2009 02:02 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:50 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft