The information in this article applies to:
SUMMARY
The following files are available from Microsoft Technical Support.
These constants are available automatically in Microsoft Project. However, if you want to use Microsoft Project OLE Automation objects in a Standard or Professional Edition Visual Basic project, you must either add the PJCONST.BAS or VBACONST.BAS constants files to your Visual Basic project (so that you can use the constants by name), or you must use the numeric values of the constants. You can open and print these files using any text editor and then use the printouts as references when you write code. The files list the names of all the constants along with their numeric values. MORE INFORMATIONThe following file is available for download from the Microsoft
Download Center. Click the file name below to download the file: Wp1043.exeNOTE: WP1043.EXE contains the files listed in the Summary section. For more information about how to download files from the Microsoft Download Center, please visit the Download Center at the following Web address http://www.microsoft.com/downloads/search.aspand then click How to use the Microsoft Download Center. WHY USE BUILT-IN CONSTANTS?When you create Visual Basic procedures in Microsoft Project, you can use constants to represent values that you use frequently. Using constants makes your code easier to read and easier to maintain. For example, if you use the value 8h frequently, you can define a constant called <myvalue>, and then use <myvalue> in your procedure everywhere you would use the value 8h. If you change the value of <myvalue>, you only have to make the change in one location instead of in each place you used the value 8h.Microsoft Project and Visual Basic, Applications Edition, have built- in constants that are used with functions, methods, objects, and properties. The Microsoft Project built-in constants all begin with the letters "pj," and the Visual Basic, Applications Edition, built-in constants begin with the letters "vb." When you use built-in constants, your Visual Basic code is easier to read because built-in constants describe the functions they perform. For example, to change the alignment of the text in a column, you could use the following Visual Basic code:
The built-in constant, pjCenter, is easier to remember than the
numeric value it represents. Without using the Microsoft Project built-
in constant, the line above would appear as follows:
Note how much more intuitive this line of code is when it contains the
built-in constant name.
USING BUILT-IN CONSTANTS WITH VISUAL BASIC PROFESSIONAL OR STANDARD EDITIONTo use these constants in the Standard or Professional Editions of Visual Basic, you must declare them. In most cases, you will want to declare them globally by loading them into a code module. If you want to limit the scope of the constants to a form or procedure, change the Global declaration to Const, and paste only the constants you want to use in the Declaration section of the form or procedure.To load PJCONST.BAS or VBACONST.BAS into a code module:
WHERE ARE BUILT-IN CONSTANTS LISTED IN MICROSOFT PROJECT?If you want to know which built-in constants are available for a particular function, method, object, or property, search in the Visual Basic Reference in Microsoft Project Help for the item you're looking for or use the Object Browser to view a list of built-in constants.To use Help to see which built-in constants are available for a particular item:
To look up constants using the Object Browser:
Additional query words:
Keywords : kbappnote kbcode kbprg |
Last Reviewed: December 4, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |