Expand Minimize

Document.VBProjectData Property (Visio)

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

Version Added: Visio 2002

expression .VBProjectData

expression A variable that represents a Document object.

Return Value

Byte()

You can use the VBProjectData property to determine whether a document has a project. The following macro shows how to get a reference to a document in Microsoft Visio to determine whether the document has a project. The code runs from a program outside the Visio document.

Private Sub Form_Load() 
 
 'Declare document variable 
 'and Array variable to hold project data. 
 Dim vsoDocument As Visio.Document 
 Dim btProjectData() As Byte 
 
 'Get the first object in the Documents collection 
 'of this instance of Visio. 
 Set vsoDocument = GetObject(, "Visio.Application").Documents(1) 
 
 'Populate the array with project data. 
 btProjectData = vsoDocument.VBProjectData 
 Debug.Print LBound(btProjectData); UBound(btProjectData) 
 
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.

Show:
© 2014 Microsoft