deleting all hidden or document properties of all documents from folder with macro

genetist

Board Regular
Joined
Mar 29, 2013
Messages
75
Office Version
  1. 2016
Platform
  1. Windows
Hi
I have some excel files in a folder but they contained some hidden information like author name, last modified etc now I want to remove all this information from all the files in a folder at a time. Now i am using MSDN macro but this maro will remove one document properties at a time. Now I need macro that will remove all document properties in one shot. Cn anyone help me in this regards and any help would be highly appreciated

This is my present macro code

Rich (BB code):
Sub TestRemoveDocumentInformation()
  ' Set up a named range with a comment:
  Dim nm As Name
  Set nm = Names.Add(Name:="TestNamedRange", _
   RefersToR1C1:="=Sheet1!R1C1:R7C3")
  nm.Name = "NamedRange"

   ' To see the comment, click the Formulas tab menu and then 
   ' click Name Manager.
  nm.Comment = "Here is a comment"
 
  ' Set some document properties:
  Dim props As Office.DocumentProperties
  Set props = ActiveWorkbook.BuiltinDocumentProperties
  props("Author").Value = "Author Name"
  props("Subject").Value = "Test Document"
 
  ' Add a comment, which includes your name.
  ' Removing information converts author name to Author
 
  Dim cmt As Comment
  Set cmt = Range("B3").AddComment
  cmt.Visible = False
  cmt.Text "This is a test"

  ' Remove comments, defined name comments, personal information, and document properties.
  ActiveWorkbook.RemoveDocumentInformation xlRDIComments
  ActiveWorkbook.RemoveDocumentInformation xlRDIDefinedNameComments
  ActiveWorkbook.RemoveDocumentInformation xlRDIRemovePersonalInformation
  ActiveWorkbook.RemoveDocumentInformation xlRDIDocumentProperties
End Sub

Thanks in advance
Regards,
Genitist
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Forum statistics

Threads
1,213,484
Messages
6,113,924
Members
448,533
Latest member
thietbibeboiwasaco

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top