Total Visual SourceBook

Total Visual SourceBook CD and Printed Manual

Microsoft Access/ Office 2016, 2013, 2010, and 2007 Version
is Shipping!

New features in Total Visual SourceBook for Access, Office 2007 and VB6

Supports Access/Office 2016, 2013, 2010 and 2007, and Visual Basic 6.0!

Separate version for Access/Office 2003, 2002, and 2000.

Separate version for:
Access 97/95

View all FMS products for Microsoft AccessAll Our Microsoft Access Products

SourceBook Info:

Why SourceBook?


"The code is exactly how I would like to write code and the algorithms used are very efficient and well-documented."

Van T. Dinh, Microsoft MVP




Microsoft Access, Office/VBA, VB6 Modules royalty-free source code libraryMicrosoft Access Modules royalty-free source code libraryMicrosoft Access VBA and VB6 Module Library Free trial of Total Visual SourceBook for Microsoft Access, Office, VB6 and VBA

Class: XMLTreeView in Category XML Files : XML Files from Total Visual SourceBook

Populate a Microsoft TreeView control with the contents of an XML file by using the XML Document Object Model (as provided through the Microsoft XML Parser components) for VB6 and 32-bit VBA.

Note that due to limitations of the treeview you will receive errors if the treeview node count exceeds 32767. Also note that this code is not supported in the 64-bit version of Access 2010 or 2013 due to the use of the Common Controls of MSComCtl32.ocx.

Procedure List

Procedure Name



(Declarations) Declarations Declarations and private variables for the CXMLTreeView class
SourceFile Property Get the path and name of the XML source file.
Treeview Property Set the treeview to populate with the XML data.
Class_Initialize Initialize Initialize the class.
DOMNodeToTreeViewNode Method Convert the passed node to the Treeview data structure.
LoadTreeview Method Load the XML document into the treeview.
FormatAttributes Private Get a list of the node's format attribute names and values.
FormatNodeString Private Format a node into string data depending on its attributes.
mxmlDocument_OnDataAvailable Private Event raised by the XML parser when data is available.
mxmlDocument_OnReadyStateChange Private Event raised by the XML parser when the Ready State changes.

Example Code for Using Class: XMLTreeView

' To use this example:
' 1.  Create a new form.
' 2.  Create the following command button: cmdLoadXML
' 3.  Create the following textbox: txtSourceFile
' 4.  Create the following Treeview: tvwTest
' 5.  Paste the entire contents of this module into the new form's module.

' This example assumes that the sample files are located in the folder named by the following constant.
Private Const mcstrSamplePath As String = "C:\Total Visual SourceBook 2013\Samples\"

Private Sub cmdLoadXML_Click()
  ' Create an instance of our class
  Dim MyXML As New CXMLTreeView

  With MyXML

    ' Get the source file
    .SourceFile = Me.txtSourceFile.Value

    ' Set our treeview to the class
    Set .Treeview = Me.tvwTest.Object

    ' Load the data

  End With

End Sub

Private Sub Form_Load()

  ' Set up the form
  cmdLoadXML.Caption = "LoadXML"

  ' Set a default file
  txtSourceFile.Value = mcstrSamplePath & "ADOXMLTEST.XML"

  ' Set up our treeview
  With tvwTest
    .Indentation = 0.5
    .LineStyle = tvwRootLines
    .Style = tvwTreelinesPlusMinusPictureText
  End With

End Sub

Microsoft Access Module LibraryOverview of Total Visual SourceBook

The source code in Total Visual SourceBook includes modules and classes for Microsoft Access, Visual Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily add this professionally written, tested, and documented royalty-free code into your applications to simplify your application development efforts.

Additional Resources