190 likes | 348 Views
Microsoft Visual Basic. By Alan I. Rea. Chapter 1: VBA and You Objectives. Learn VBA history Understand why to use VBA Understand programming concepts Use the Word VBA IDE Use the Excel VBA IDE Record macros Manipulate macros Assign a VBA macro Printing a macro. VBA History.
E N D
Microsoft Visual Basic By Alan I. Rea
Chapter 1: VBA and YouObjectives • Learn VBA history • Understand why to use VBA • Understand programming concepts • Use the Word VBA IDE • Use the Excel VBA IDE • Record macros • Manipulate macros • Assign a VBA macro • Printing a macro
VBA History • Originated from BASIC • BASIC – Beginner’s All-purpose Symbolic Instruction Code • Developed by Dartmouth professors John Kemeny and Thomas Kurtz in 1964
VBA History • Visual Basic Application (VBA) • Programming language • Customized solutions within software applications • Scripting language –programming language that works with another application to perform tasks
VBA History • Visual Basic • Introduced in 1992 • Used to create software programs • Included in Microsoft Office 97 • Word, Excel, Access, and PowerPoint • Included in Microsoft Office 2000 • Word, Excel, Access, PowerPoint, and Outlook 2000
Why Use VBA? • Businesses • Manage inventories • Type letters and memos • Manage budgets and figures • Send and receive e-mail • Give presentations • Horizontal Market Software – general business software that has applications in many industries
Why Use VBA? • Vertical Market Software – software that is unique to a particular industry • Businesses are able to use VBA to customize an existing Microsoft Office application • VBA • Saves businesses money • No need to hire software consultants
Programming Concepts • Programmer • Understand business needs • Map out necessary steps • Pseudocode – uses English statements to create outline of the steps necessary for a piece of software to operate • Steps are called an algorithm • Program flowchart – graphical description of the detailed steps that a piece of software will perform • Logic error – a mistake in the way an algorithm solves a problem
Programming Concepts • Write like a programmer • Coding • Syntax • Reverse words • Comments
Programming Concepts • Working like a programmer • Debugging • Bugs • Syntax errors • Run-time errors
Programming Concepts • VBA’s Role in Microsoft Office • Allows you to do more in a shorter period of time • Decreases development time and costs • Allows users to use the existing power of Microsoft Office • Adds features and functionality to applications quickly
Use the Word VBA IDE • IDE – Integrated Development Environment • Provides tools • Create • Debug • Manage • VBA editor • Macro virus – a computer virus hidden in macro code within a file or template
Use the Word VBA IDE • Opening the VBA IDE • Click Tools on the menu bar, select Macro, click Visual Basic Editor
Use the Excel VBA IDE • Click Tools on the menu bar, select Macro, select Visual Basic Editor
Record Macros • Start Microsoft Word • Click Tools on the menu bar • Select Macro • Click on Record New Macro
Manipulate Macros • Open the VBA IDE • Click on the object containing the Macro • Press F7 to open the Code Window
Assign a VBA Macro • Click Tools on the menu bar • Select Customize • Assign a macro to a button
Printing Macros • Open the VBA IDE • Select File • Click Print