Is it possible to remove Visio file metadata with some VBA?

Started by Visisthebest, November 07, 2022, 09:12:01 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Visisthebest

Does anyone know: is it possible to remove Visio file metadata with some VBA? (metadata of info like file author).
Visio 2021 Professional


Visisthebest

Thank you Nikolay very useful this is possible with VBA, I am thinking as a next step:

1. Remove hidden information
2. Save file
3. Check the relevant 'fields' to make sure this information is deleted (strings set to '')

Is step 3 also possible with VBA I am wondering.
Visio 2021 Professional

Nikolay

Probably there is no point to check using the same API you just used to clear it.
That is, how would you know that the API that "checks" is more reliable than the API that "clears"?  ;D

BTW, the "Author" field is returned by Document.Creator

If you want to be 200% sure, extract the content of the file as XML, remove the information you don't like and then pack back.
Visio is not required to do that, just a zip/unzip app.

Visisthebest

Thank you Nikolay, related to this I understand LINQ is a very powerful way to query data from Visio files from its internal XML format.
Visio 2021 Professional

Nikolay

I'm not quite sure about LINQ (do you mean, the LINQ from .NET framework, or some app?).
To verify the author is not there, notepad should be enough actually :)

Visisthebest

Yes of course, but for some more advanced use cases VB.NET/C# LINQ can be quite powerful with XML.
Visio 2021 Professional