Link to home
Create AccountLog in
Avatar of Jamie Garroch (MVP)
Jamie Garroch (MVP)Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Can I delete the entire data item in an Office document .ContentTypeProperties with VBA?

I can use the .ContentTypeProperties collection to inspect and clear any data values in a document but I need to be able to delete the named item too. I believe this collection is being created by SharePoint.

It appears that the built-in Office document inspector (File / Info / Check for Issues / Inspect XYZ) is able to delete the entire data (I believe listed as "Document server properties" in the Inspector).

Is there a way to do the same with VBA?

There appears to be no .Delete method as in these test examples:

' PowerPoint
ActivePresentation.ContentTypeProperties(1).Delete
' Excel
ActiveWorkbook.CustomDocumentProperties(1).Delete
' Word
ActiveDocument.CustomDocumentProperties(1).Delete

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Professor J
Professor J

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Jamie Garroch (MVP)

ASKER

You are a life saver ProfessorJimJam. It's one of those parts of the OM where you'd expect there to be a .Delete method for items but then MS go and throw in a curved ball API! Thank you.

This is what works for me in PowerPoint:

ActivePresentation.RemoveDocumentInformation ppRDIAll
PJJ - nice link :0
Avatar of Professor J
Professor J

Jamie,

thanks for the feedback. i am glad you find a solution that worked for you.
DrTribos

thanks :-)