Get VISIO XML to string in VBA

Hi everyone,

I have a question that is critical and is driving me crazy. Visio 2003 allows you to save documents as XML. If you want to save it to a file, it is very easy and the API allows that. However, what I want to do is get the XML representation of the document in a string variable inside my VBA code.

So, basically I have a VB macro inside the Visio document and I have a string variable and I want to have the current XML representation of the Visio document.

How can I do this? i cannot have a file being saved in the hard drive. I must have the XML string from within the application!

Please help!

Thanks!

xargon
xargon_123Asked:
Who is Participating?
 
gbzhhuConnect With a Mentor Commented:
For what I can see so far there is no simple property in the Visio object modal that extracts the documents whole xml, something like Document.GetXML  I will carry on digging around.
0
 
gbzhhuCommented:
I don't know much abour Visio but have you tried

myXMLStr = ActiveDocument.SolutionXMLElement(ActiveDocument.SolutionXMLElementName)
0
 
xargon_123Author Commented:
Well, the SolutionXML element is only one tag in the overall XML that encapsulates custom XML in the Visio document. I need to get the whole document XML.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
xargon_123Author Commented:
Hi,

Again, the problem is that the SolutionXML does not get the whole Visio document. Only a sub-set of it.

That guy in the link has the same problem as me!
0
 
xargon_123Author Commented:
Yeah, I know. That is why I am going crazy :(

I am also hoping that there is a work-around by creating a file in memory and saving the data there. But again, I do not know how to create a file completeiy in memory  and be able to use it in the SaveAs method as the SaveAs methods expects the file path string.

cheers!
0
All Courses

From novice to tech pro — start learning today.