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

Microsoft SharePointVisual Basic ClassicMicrosoft OfficeMicrosoft ExcelMicrosoft PowerPoint

Avatar of undefined
Last Comment
Professor J
ASKER CERTIFIED SOLUTION
Avatar of Professor J
Professor J

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
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
Avatar of DrTribos
DrTribos
Flag of Australia image

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.
Avatar of Professor J
Professor J

DrTribos

thanks :-)
Visual Basic Classic
Visual Basic Classic

Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.

165K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo