Excel VBA: How To Remove Document Inspector Warning Include Personal Information

You may get warning message about the Document Inspector when you want to save Excel file. Is there a script can remove this warning?

Warning Message

Document Inspector Warning

Be careful! Parts of your document may include personal information that can't be removed by the Document Inspector.

Remove Document Inspector Warning

  1. Go to File > Info
  2. and Click in "Allow this information to be saved in your file".

OR:

  1. Goto File in the upper left hand corner
  2. Options > Trust Center > Trust Center Settings > Privacy Options >
  3. Un-check the check box that says "Remove personal information from file properties on save"
  4. Hit OK.

Remove Document Inspector Warning By VBA

'------------------ Copy to ThisWorkbook ------------------
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    ActiveWorkbook.RemovePersonalInformation = False
End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *