Download presentation
Presentation is loading. Please wait.
Published byMorgan O’Neal’ Modified over 9 years ago
1
Key Concepts 2 Simple VB Procedures Simple VB Applications - take with Other Examples - time permitting
2
Object Libraries (aka APIs) Allows you to control one Microsoft Office application from another. Project Microsoft Project’s Object Library is a hierarchical organization of “things” contained in a Microsoft Project file (a collection of collections). ResourcesTasksActions AssignmentsDependencies Other Stuff From Deps To Deps
3
Excel Workbook? Workbook WorksheetsActions RowsColumns Other Stuff Cells Actions
4
Exchanging Data between Object Libraries & Applications. Project File ResourcesTasksActions AssignmentsDependencies From Deps To Deps
5
Use VB to Get data from Object Libraries Project File ResourcesTasksActions AssignmentsDependencies Tools/Macro/Visual Basic Editor
6
VB Procedures can be written in a project file or in a Global file
7
VB Procedures are written in a “notepad like” environment
8
VB Procedures are called Sub statements and are written between the Sub and End Sub line A good practice is to Declare Objects that you plan to use with a line that starts with Dim (Dim t as task tells VB that t is a reference to Task Objects)
9
Simple VB to get values from a project file For/Next Loop – moves VB from one task to the next: For each Task in ActiveProject.Tasks MsgBox Task.Name Next Task This example starts with the first task in a project, displays a message box containing the task name, then continues to the next task until the end of the project is reached.
10
Simple VB to get values from a project file If/Then – tests if a condition exists: For each Task in ActiveProject.Tasks If Task.Summary = True Then MsgBox Task.Name End if Next Task In this example, the message box will display only if a task is a summary
12
VB Procedures may not run if your security settings are set to the highest level. Select Tools/Macro/Security to change security level. You can add a digital signature to a macro you write (Tools/Digital Signatures in the VB editor). That lets users know that your VB is safe to run.
13
If you plan to use objects from an application’s object library, you must select those libraries in the References form (Tools/References in VB editor) Shown to the right are the libraries used in the SSI Tools examples
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.