VISUAL BASIC 2 EDITOR

Similar documents
Chapter 1 INTRODUCTION SYS-ED/ COMPUTER EDUCATION TECHNIQUES, INC.

You can record macros to automate tedious

Customizing the Excel 2013 program window. Getting started with Excel 2013

Excel VBA. Microsoft Excel is an extremely powerful tool that you can use to manipulate, analyze, and present data.

Getting Started with. Microsoft Office 2010

Lab 7 Macros, Modules, Data Access Pages and Internet Summary Macros: How to Create and Run Modules vs. Macros 1. Jumping to Internet

Getting started 7. Writing macros 23

This chapter is intended to take you through the basic steps of using the Visual Basic

Excel 2016: Introduction to VBA

BASIC EXCEL SYLLABUS Section 1: Getting Started Section 2: Working with Worksheet Section 3: Administration Section 4: Data Handling & Manipulation

Microsoft Office Excel Create a worksheet group. A worksheet group. Tutorial 6 Working With Multiple Worksheets and Workbooks

Excel The primary replacement for menus and toolbars in Office Excel 2007 is the Ribbon. Designed for easy browsing, the

This document describes how to use the CAP workbook with Excel It applies to version 6b of the workbook.

Copyright. Trademarks Attachmate Corporation. All rights reserved. USA Patents Pending. WRQ ReflectionVisual Basic User Guide

Discovering Computers & Microsoft Office Office 2010 and Windows 7: Essential Concepts and Skills

OpenForms360 Validation User Guide Notable Solutions Inc.

MFS CONCEPTS 1 & COMPONENTS SYS-ED/ COMPUTER EDUCATION TECHNIQUES, INC.

Excel Vba Manually Update Links Automatically On Open Workbook Don

Microsoft Excel > Shortcut Keys > Shortcuts

Visual Basic Primer A. A. Cousins

Read Me First (Excel 2007)

The purpose of this tutorial is to introduce you to the Construct 2 program. First, you will be told where the software is located on the computer

Microsoft Excel 2010 Level 1

Getting Started with Excel

Contents. Some Basics Simple VBA Procedure (Macro) To Execute The Procedure Recording A Macro About Macro Recorder VBA Objects Reference

Excel window. This will open the Tools menu. Select. from this list, Figure 3. This will launch a window that

Macros in Excel: Recording, Running, and Editing

Consolidate and Summarizing Data from Multiple Worksheets

Microsoft Excel 2016 Level 1

Chapter 5 Making Life Easier with Templates and Styles

UNIT 3 INTRODUCTORY MICROSOFT EXCEL LESSON 6 MAKING THE WORKSHEET USEFUL

Microsoft MOS-EXP. Microsoft Excel 2002 Core.

Getting started 7. Setting properties 23

TABLE OF CONTENTS. 2 ADDING, REMOVING, AND RESIZING FRAMES IN A FLEX DOCUMENT. 4 ADDING SHEETS. 6 STACKING APPS. 8 SHOWING/HIDING APP TOOLBARS.

MICROSOFT EXCEL KEYBOARD SHORCUTS

Upravljanje softverskim projektima Part 3 Special Subjects

Insert Subtotals in Excel and Link Data to a Word Document

Tutorial 6: Managing Multiple Worksheets and Workbooks. Microsoft Excel 2013 Enhanced

Excel Vba Manually Update Links On Open Workbook Without Updating

MS Outlook. How to Increase Your Productivity With

Table of Contents. Contents

Microsoft Microsoft Excel 2013 Expert Part 1. Download Full Version :

MS Excel VBA Class Goals

RegressItMac installation and test instructions 1

Microsoft Excel 2007 Macros and VBA

Advance Excel Performing calculations on data 1. Naming groups of data 2. Creating formulas to calculate values

You can make certain sections of the text clickable by creating hyperlinks. Once clicked, these links navigate users to different

Table of Contents Lesson 1: Introduction to the New Interface... 2 Lesson 2: Prepare to Work with Office

Ms Excel Vba Continue Loop Through Worksheets By Name

Using macros enables you to repeat tasks much

Getting started 7. Setting properties 23

BDM Hyperion Workspace Basics

How to work a workbook

Instruction How To Use Excel 2007 Macros >>>CLICK HERE<<<

Microsoft Office Excel 2007: Basic Course 01 - Getting Started

Productivity Tools Objectives 1

Free Microsoft Office 2010 training from MedCerts. Course Outline

Click the buttons in the interactive below to learn how to navigate and interact with slides in the

Excel Vba Manually Update Links On Open Workbook Don

Highline College. Office 2016 Video #01: Introduction to Office 2016 & Windows Explorer

Create and print labels for a mass mailing

2. create the workbook file

AutoCAD 2009 User InterfaceChapter1:

Chart Wizard: Step 1 (Chart Types)

A.Office 2010 B.Windows C.Excel 2010 D.Calc

1. Right-click the worksheet tab you want to rename. The worksheet menu appears. 2. Select Rename.

Mail Merge. To Use Mail Merge: Selecting Step by Step Mail Merge Wizard. Step 1:

TM1 Technical Bulletin

The Basics of PowerPoint

Explore commands on the ribbon Each ribbon tab has groups, and each group has a set of related commands.

with TestComplete 12 Desktop, Web, and Mobile Testing Tutorials

North Shore Innovations, Ltd.

Overview of the Adobe Dreamweaver CS5 workspace

Excel Programming with VBA (Macro Programming) 24 hours Getting Started

EXAM Microsoft Excel 2010 Expert. Buy Full Product.

Module 4 : Spreadsheets

Introduction. Saving Workbooks. Excel 2010 Saving. To Use the Save As Command: Page 1

Corporate essentials

A Guide to Quark Author Web Edition 2015

Financial Management System

Navigating a Database Efficiently

Advanced Financial Modeling Macros. EduPristine

Information Technology (IT) Paper-I Theory 40 Practical - 60

Unit 12. Electronic Spreadsheets - Microsoft Excel. Desired Outcomes

Lesson 1: Exploring Excel Return to the Excel 2007 web page

Print Meeting Vector Counts

Add Tags to a Sent Message [New in v0.6] Misc 2

DOWNLOAD PDF MICROSOFT OFFICE POWERPOINT 2003, STEP BY STEP

Review the interactive to learn how to navigate and interact with slides in the PowerPoint window.

Contents SECTION-I : LINUX

MODULE VI: MORE FUNCTIONS

Chapter11 practice file folder. For more information, see Download the practice files in this book s Introduction.

From the Insert Tab (1), highlight Picture (2) drop down and finally choose From Computer to insert a new image

What s New in Access 2007

Excel 2010 Level 1: The Excel Environment

Microsoft Word 2011: Basic Tutorial

Microsoft Access 2013

How To Remove Header From First Two Pages In Word 2007

Introduction... 1 Part I: Getting Started with Excel VBA Programming Part II: How VBA Works with Excel... 31

Learning TradeStation. Essentials of the TradeStation Desktop

Transcription:

VISUAL BASI 2 EDITOR hapter SYS-ED/ OMPUTER EDUATION TEHNIQUES, IN.

Objectives You will learn: How to edit code in the. How to create, open, and access project(s). How to edit scripts and use the code window. SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (VBA - 0.7) h 2: Page i

1 Getting Started Microsoft Excel, Word, Access, and PowerPoint come equipped with the. This development environment can be used for creating, editing, debugging, and running code associated with Microsoft Office documents. To open the, click the button on the Visual Basic toolbar. F or inf or m ati o n about a particular window in the, click in the window and then press F1 to open the appropriate Help topic. To see the Help topic for any other element of the, such as a particular toolbar button, search Help for the name of the element. SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (VBA - 0.7) h 2: Page 1

1.1 The Properties Window A property is a characteristic of an object, such as the object's color or caption. A property is set to specify a characteristic or behavior of an object. The ShowSpellingErrors property of a Word document can be set to True to show spelling errors in the document. The Properties window is used to set the properties of an object at design time. It is useful when working with custom dialog boxes and ActiveX controls. For most objects, however, it's easier to set these properties at design time by using familiar commands in the user interface. The ShowSpellingErrors property of a Word document can be set to True by selecting the Hide spelling errors in this document check box on the Spelling & Grammar tab in the Options dialog box (Tools menu). If the Properties window right is not being used, it can be closed to simplify the work space a little. It can be opened at any time by clicking Properties Window on the View menu. SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (VBA - 0.7) h 2: Page 2

1.2 The Project Explorer All the code associated with a workbook, document, template, or presentation is stored in a project which is automatically stored and saved with the workbook, document, template, or presentation. In the Project Explorer of the, it is possible to view, modify, and navigate the projects for every open or referenced workbook, document, template, or presentation. The Project Explorer can be resized and either docked or undocked from any of the sides of the window. In Word, because the Normal template is available from every Word document, there's always a project for Normal in the Project Explorer. Within a project, there can be application objects that have events associated with them: custom dialog boxes (called forms in the Project Explorer) standard modules class modules references Folders in the Project Explorer divide project elements into categories. If no folders are visible, click the Toggle Folders button at the top of the Project Explorer. In the Project Explorer, there's one project for each open or referenced workbook, document, template, or presentation. SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (VBA - 0.7) h 2: Page 3

In each project, there typically will be: Objects such as Document objects, Workbook objects, and Worksheet objects which recognize events. Forms, also known as UserForms, are custom dialog box interfaces which include code that control how the user interacts with a particular dialog box. Standard modules, which contain code that isn't associated with a particular object or form. lass modules, which contain information about a custom object type. References to other projects. To see the code in a module or the code associated with an object or form: 1. lick the element in the Project Explorer. 2. lick the View ode button at the top of the Project Explorer. To see the user interface for a particular object or form: 1. lick the object or form in the Project Explorer. 2. lick the View Object button at the top of the Project Explorer. To view the code in a project: 1. Go to the Project Explorer. 1.3 The ode Window 2. lick the element that contains the code. 3. lick the View ode button at the top of the Project Explorer. To be able to see more than one procedure in the code window at a time, select the Default to Full Module View check box on the Editor tab in the Options dialog box (Tools menu). To view just one procedure at a time, clear this check box. SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (VBA - 0.7) h 2: Page 4

The ode window can be navigated by using the items listed in the Object and Procedure boxes at the top of the window. In the Object box: lick (General). Then click a procedure name in the Procedure box to see a procedure that isn't associated with a specific event. In the Object box: lick an object. Then click an event in the Procedure box to see the code that runs when a specific event occurs. SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (VBA - 0.7) h 2: Page 5

2 Making Room in the When writing a simple procedure or editing a previously recorded macro, it usually will be a good practice to forego some of the advanced features of the in the interest of a simpler workspace. A few ways for simplifying a coding environment are to: lose the Properties window. Unless there is a need for working with custom dialog boxes or ActiveX controls, the Properties window probably will not be of much use. To reopen Properties window, click Properties Window on the View menu. Hide any toolbars not being currently used. To redisplay the Debug, Edit, Standard, or UserForm toolbar, right-click the menu bar, and then click the name of the toolbar to be displayed. When working with code in a standard module and there is no need to navigate to other code in the project or to code in other projects, consider closing the Project Explorer. To reopen the Project Explorer, click Project Explorer on the View menu. SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (VBA - 0.7) h 2: Page 6

3 Recording a Macro The macro recorder can be used to translate user-interface actions into Visual Basic code. Recording a simple macro provides a jump start on creating a more complex macro, and also serve familiarize the programmer with the objects, properties, and methods of an application. To record a macro: 1. To display the Visual Basic toolbar, point to Toolbars on the View menu in the application window (not in the ), and then click Visual Basic if it isn't already selected. 2. On the Visual Basic toolbar, click the Record Macro button. 3. In the Record Macro dialog box, replace the default macro name in the Macro name box if you want, and click OK. The Store macro in box can be used to choose where the macro will be stored. For now, click This Workbook in Microsoft Excel, All Documents (Normal.dot) in Word, or the name of the active presentation in PowerPoint. 4. Perform the actions for which Visual Basic code is to be generated. 5. On the Stop Recording toolbar, click the Stop Recording button. The macro has now been recorded. To look at the macro code: 1. Point to Macro on the Tools menu. 2. lick Macros. 3. In the Macros dialog box, select the appropriate macro name, and then click Edit. SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (VBA - 0.7) h 2: Page 7

4 Getting Around in Projects The Project Explorer is used to navigate to any procedure in any open project. Start by finding the object that contains the macro. Most general procedures, including recorded macros, are stored in a standard module. If there are folders displayed in the Project Explorer, standard modules are located in the Modules folder. If folders are not visible in the Project Explorer, click the Toggle Folders button to display them. After locating the object that contains the code, double-click the object to view the procedures it contains. This method can be used to get to procedures which have been either written from scratch or macros which have been recorded. Where a recorded macro is stored depends on the location which has been specified in the Store macro in box in the Record Macro dialog box when the macro was recorded. Application In Microsoft Excel In Microsoft Word In PowerPoint Location If This Workbook in the Store macro in box was clicked when the macro was being recorded, the macro will be stored in Module1 in the Modules folder of the project for the workbook in which the macro was recorded. If All documents (Normal.dot) in the Store macro in box was clicked when the macro was being recorded, the macro will be stored in the NewMacros module in the Modules folder of the Normal project. If the name of the active presentation in the Store macro in box was clicked when the macro was recorded, the macro will be stored in Module1 in the Modules folder of the project for the presentation from which the macro was recorded. To be able to see more than one procedure in the code window at a time, make sure that the Default to Full Module View check box is selected on the Editor tab in the Options dialog box (Tools menu). Otherwise, the Procedure box in the code window can be used to move from one procedure to another. SYS-ED \OMPUTER EDUATION TEHNIQUES, IN. (VBA - 0.7) h 2: Page 8