VBProjectData property

Microsoft Visio Developer Reference

VBProjectData property

See also       

Returns the Microsoft Visual Basic project data stored with a document.

Version added

2002

Syntax

valRet = object.VBProjectData

valRet

Byte. An array of data stored with a document's Visual Basic project.

object

Required. An expression that returns a Document object.

Example

You can use the VBProjectData property to determine whether a document has a project. The following macro demonstrates getting a reference to a document in Visio to determine whether the document has a project. The code runs from a program outside of the Visio document.

Private Sub Form_Load()
    'Declare document variable
    'and Array variable to hold project data
    Dim docObj As Object
    Dim projdata() As Byte
    'Get the first object in the Documents collection
    'of this instance of Visio
    Set docObj = GetObject(, "Visio.Application").Documents(1) 
    'Populate the array with project data
    projdata = docObj.VBProjectData
    Debug.Print LBound(projdata); UBound(projdata) 
End Sub

If the document had no project associated with it, "0 –1" would be reported in the Immediate window. If the document had a project, the upper bound would be some number greater than zero (0). For example, "0 1535" would indicate that a project had 1,536 bytes of data.