Macro for removing OLE Objects

Hello everyone,

I’m new here and want to ask if it is possible to write a macro and remove all ole objects inside that document. Is there reference page to call ole objects inside a macro?


Such a routine is possible. I think it will have to look rather differentl in the parts concerning ‘Writer’ and ‘Calc’ respectively. OLE objects are basically shapes contained in a DrawPage. The property to be an OLE object will be contained in the SupportedServiceNames property of the respective element of the DrawPage.

Now a relevant difference: A ‘Writer’ document has exactly one DrawPage which can enumerate its elements. ‘Calc’ documents have one DrawPage per sheet. As far as I can see they cannot enumerate their elements. You need to access them by DP.GetByIndex()

You may have to do some studies concerning the API to achieve your goals.