Visual basic for applications the environment
This presentation is the property of its rightful owner.
Sponsored Links
1 / 14

Visual Basic for Applications - The Environment PowerPoint PPT Presentation


  • 56 Views
  • Uploaded on
  • Presentation posted in: General

Visual Basic for Applications - The Environment. What is an event-driven program? A user interface? What are Access/Accelerator Keys? NOTE: Important material on VBA is in the Course Guide at the start of this lecture slide section, so read those pages soon!. What does it look like?.

Download Presentation

Visual Basic for Applications - The Environment

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Visual basic for applications the environment

Visual Basic for Applications - The Environment

  • What is an event-driven program?

  • A user interface?

  • What are Access/Accelerator Keys?

  • NOTE: Important material on VBA is in the Course Guide at the start of this lecture slide section, so read those pages soon!

CS 105 Spring 2010


What does it look like

What does it look like?

CS 105 Spring 2010


Why learn visual basic for applications

Why Learn Visual Basic for Applications?

  • Widely used to create applications for the PC and to jazz up Windows, Browsers, etc.

  • Excel and Access can be modified by Visual Basic for Applications (VBA is built in, but will stop in the next version of Office)

  • FUN to do--you can see your results quickly

CS 105 Spring 2010


What is a software program

What is a software program?

A series of instructions to the

computer to do some task

Right now, this computer is

running a master program

(Windows OS) controlling many

smaller programs (Powerpoint)

CS 105 Spring 2010


Visual basic for applications

Visual Basic for Applications:

BASIC stands for Beginner’s All-purpose Symbolic Instruction Code.

  • Developed in the 1960s.

    Microsoft developedVisual Basicin 1991.

  • Lets you make stand-alone programs

    Visual Basicfor Applications

  • Allows you to program in Microsoft applications, to create or improve macros, to create user interfaces, and even make your own programs.

CS 105 Spring 2010


Programming languages visual basic for applications

Programming Languages: Visual Basic for Applications

  • A program’s ability to respond to events

  • Forms the basis of event-driven programming

  • Responds to user-initiated events such as keystroke or click, or even opening up a workbook

    examples: Visual Basic for Applications, Java

  • Uses Objects such as command buttons, cells, pictures, charts, spreadsheets.

CS 105 Spring 2010


What is an event

What is an Event?

  • An event is

    any action to an object that is recognized by an application such as Excel.

    • Opening or closing an Excel workbook

    • Clicking on a command button

    • Changing the data in a cell

  • An event procedure

    is code that runs in response to the event.

CS 105 Spring 2010


What does a procedure look like

What does a procedure look like?

Private Sub cmdCopy_Click()

[F8].Value = [C8].Value

End Sub

CS 105 Spring 2010


Calling event procedures

Calling Event Procedures

You can run one procedure from another procedure.

You "call" it, even if it is stored in another module/worksheet. You call a subprocedure by writing its name:

Private Sub cmdRun_Click()

cmdFormat_Click

End Sub

CS 105 Spring 2010


Graphical user interface

Graphical User Interface

  • You create the GUI (graphical user interface)/ CHI (computer-human interface)

    You create prompts, questions to the user

    Key entry, Mouse Click, Menu Selection, Text or data entry

    You decide the program responses to user actions

    Including Computations, Change of Interface, etc.

CS 105 Spring 2010


What happens when you use vba

What happens when you use VBA

  • You create Input Boxes or use controls to gain input from the user.

  • You insert code behind spreadsheet, in the VISUAL BASIC EDITOR, to process the information.

  • The basic building block of a VBA program is the

    procedure

    (subroutine = sub procedure = sub)

CS 105 Spring 2010


Assignment statement

Assignment Statement

  • [cell reference].Value = expression

  • Example 1: [B3].Value = 9

  • Meaning: The new value of cell B3 is 9

  • Example 2: [B3].Value = [B3].Value + 9

  • Meaning: The new value of cell B3 is the old

  • value of cell B3 plus 9

  • The =means "take the value on the right side and assign it tothe cell on the left side"

CS 105 Spring 2010


A flawed assignment statement

A FLAWED assignment statement

33 = [B3].Value

CS 105 Spring 2010


To summarize

To summarize:

What is

  • an event-driven program?

  • a user interface?

  • an assignment statement?

CS 105 Spring 2010


  • Login