![]() |
#1
|
|||
|
|||
![]()
Hi,
I placed theis request in Word Macor because that is where I started i guess. The following macro works perfectly for Word 2010. Code:
Sub ScrubMetaData() Basically 1 macro To copy into Word, Excel And Powerpoint. Having alot of trouble. I had some help With the following redone code, but only Excel works - Code:
Sub ScrubMetadataExcel() 'Macro for cleaning personal data from files within selected folder. Dim objFS As Object, objFolder As Object Dim objFiles As Object, objF1 As Object Dim WordFile As Object Dim PowerPointFile As Object Dim FolderPath As FileDialog Dim FolderName As String Dim DocType As String Dim CurrentFile As String Set WordFile = CreateObject("Word.Application") Set PowerPointFile = CreateObject("PowerPoint.Application") '''''''''''''''''''''''''''''''''''''''''''''' Set FolderPath = Application.FileDialog(msoFileDialogFolderPicker) With FolderPath .AllowMultiSelect = False .Show FolderName = .SelectedItems(1) End With '''''''''''''''''''''''''''''''''''''''''''''' Set objFS = CreateObject("Scripting.FileSystemObject") Set objFolder = objFS.GetFolder(FolderName) Set objFiles = objFolder.Files For Each objF1 In objFiles CurrentFile = objF1.Path Select Case Right(objF1.Name, 4) Case ".xls", "xlsx", "xlsm" ': DocType = "xlRDIAll" Workbooks.Open (CurrentFile) With ActiveWorkbook .RemoveDocumentInformation (xlRDIAll) .Save .Close End With Case ".doc", "docx", "docm" ': DocType = "wdRDIAll" WordFile.documents.Open (CurrentFile) With WordFile.ActiveDocument .RemoveDocumentInformation (wdRDIAll) .ActiveDocument.Save .ActiveDocument.Close End With Case ".ppt", "pptx", "pptm" ': DocType = "ppRDIAll" PowerPointFile.Visible = True PowerPointFile.Presentations.Open (CurrentFile) With PowerPointFile.ActivePresentation .RemoveDocumentInformation (ppRDIAll) .Save .Close End With End Select Next Set objF1 = Nothing: Set objFiles = Nothing: Set objFolder = Nothing: Set objFS = Nothing ExcelFile.Quit WordFile.Quit PowerPointFile.Quit End Sub Thanks for any help, I appreciate it. Last edited by macropod; 07-10-2014 at 01:10 AM. Reason: Added code tags & formatting |
Tags |
macro, metadata |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Can a macro rename Excel files based on a cellname? | chrisd2000 | Excel Programming | 1 | 06-23-2014 06:50 PM |
Mail merge from Excel to Word and include hyperlinks | chay | Mail Merge | 5 | 09-28-2013 01:16 AM |
![]() |
adj1 | Office | 3 | 05-10-2013 12:27 AM |
Can excel Replace metadata of image files? | quiff | Excel | 0 | 11-23-2011 12:39 AM |
Merging word files from excel macro | hklein | Excel Programming | 0 | 08-05-2011 02:27 AM |