1 / 13

Simple Visual Basic

Contents. Simple Visual Basic. Key Concepts 2 Simple VB Procedures Simple VB Applications - take with Other Examples - time permitting. Key Concepts – Object Libraries. Simple Visual Basic. Object Libraries (aka APIs) Allows you to control one Microsoft Office application from another.

cais
Download Presentation

Simple Visual Basic

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Contents Simple Visual Basic • Key Concepts • 2 Simple VB Procedures • Simple VB Applications - take with • Other Examples - time permitting

  2. Key Concepts – Object Libraries Simple Visual Basic • 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). Resources Tasks Actions Other Stuff Assignments Dependencies From Deps To Deps

  3. Key Concepts – Object Libraries Simple Visual Basic • Excel Workbook? Workbook Actions Worksheets Other Stuff Rows Columns Cells Actions

  4. Simple Visual Basic Key Concepts – Object Exchange • Exchanging Data between Object Libraries & Applications. Project File Resources Tasks Actions Assignments Dependencies From Deps To Deps

  5. Simple Visual Basic Key Concepts – Writing VB • Use VB to Get data from Object Libraries Project File Resources Tasks Actions Assignments Dependencies Tools/Macro/Visual Basic Editor

  6. Simple Visual Basic Key Concepts – Writing VB VB Procedures can be written in a project file or in a Global file

  7. Simple Visual Basic Key Concepts – Writing VB VB Procedures are written in a “notepad like” environment

  8. Simple Visual Basic Key Concepts – Writing VB 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 Visual Basic Simple VB Procedure 1 • 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 Visual Basic Simple VB Procedure 2 • 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

  11. Simple Visual Basic VB Form

  12. Simple Visual Basic VB Security Settings 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. VB Procedures may not run if your security settings are set to the highest level. Select Tools/Macro/Security to change security level.

  13. Simple Visual Basic VB Object Library References 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

More Related