Using the Visio Type Library in Visual Basic Projects

3 4

The Microsoft Visio type library contains descriptions of the objects, methods, properties, events, and constants that the Visio engine exposes. You use the Visio type library to define Visio object types and constants in your program. Using Visio object types enables early binding and increases the speed of your program.

When programming with Visio 4.5 or later, you can set a reference to the Visio type library. To set a reference to the Visio type library in Microsoft Visual Basic, click References on the Project menu, and select the Microsoft Visio 2002 type library in the Available References list.

The Visio type librarycontains global symbolic constants defined for arguments and return values of properties and methods. Most arguments for properties and methods are numeric values. Using symbolic constants can make your code easier to both write and read.

For example, suppose you want to find out what type of window a Window object represents. The Type property of a Window object returns an integer that indicates the window's type. For example, if you set a reference to the Visio type library in your project, you can use the constant visDrawing, instead of 1, to check the window's type.

For a list of constants used by a particular method or property, look up the property or method in the Microsoft Visio Developer Reference (on the Help menu, click Developer Reference).

Note


Early versions of Visio did not include a type library, so all constants were defined in Visconst.bas. Visconst.bas is no longer required because the Visio type librarycontains global constants. The examples in this guide are provided with the assumption that you have a reference set to the Visio type library.

If you use Visconst.bas instead of the Visio type library for some of your solution code, you cannot use Visio object types—you must use the generic Object variable type. For example, when defining variables, you must use Dim docsObj As Object, and not Dim docsObj As Visio.Documents. The constants in Visconst.bas are grouped by usage.



Developing Microsoft Visio Solutions 2001
Developing Microsoft Visio Solutions (Pro-Documentation)
ISBN: 0735613532
EAN: 2147483647
Year: 2004
Pages: 180

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net