ME 142 Engineering Computation I Interacting with Spreadsheets.

Slides:



Advertisements
Similar presentations
Hamilton Venus Software User Interface Options
Advertisements

1 Overview Introduction to VBA The Visual Basic Editor (VBE) –First Program Getting Started with VBA –Subroutines –Declaring variables –Input boxes and.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
© 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 7: Chapter 4: Slide 1 Unit 7 Decisions (Cont.) and Message Boxes Chapter.
Week 7.  Recap  Input Validation Message Boxes Input Boxes  Conversion Functions  Assessment 2.
UI Prototyping with VB 6.0 SIMS213 Tutorial March 5, 1999 Melody Y. Ivory.
Control Statements Making Decision in Your Program.
Exploring Office Grauer and Barber 1 Creating More Powerful Applications: Introduction to VBA(Wk9)
Automating Tasks With Macros. 2 Design a switchboard and dialog box for a graphical user interface Database developers interact directly with Access.
Input Validation Check the values entered into a text box before beginning any calculations Validation is a form of ‘self-protection’, rejecting bad data.
Input and Message Boxes. InputBox() Function An input box is a dialog box that opens and waits for the user to enter information. Syntax: InputBox(prompt[,title][,default])
Input Validation Check the values entered into a text box before beginning any calculations Validation is a form of ‘self-protection’, rejecting bad data.
MsgBox Function Displays one of Visual Basic’s predefined dialog boxes, which contains a message, one or more command buttons, and an icon After displaying.
ME 142 Engineering Computation I Macros. Key Concepts Macro Overview Recording a Macro Running a Macro Editing a Macro Using Controls.
WORKING WITH MACROS CHAPTER 10 WORKING WITH MACROS.
Week 1.  Kate Watson  Checked at least every other day. Queries and general comments welcome.
Creating Embedded Formative Assessment Dr. Steve Broskoske Misericordia University EDU 533 Computer-based Education.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
© 1999, by Que Education and Training, Chapter 5, pages of Introduction to Computer Programming with Visual Basic 6: A Problem-Solving Approach.
VBA – Visual Basic for Applications Week 20 - Tutorial.
Saeed Ghanbartehrani Summer 2015 Lecture Notes #4: Working with Variables and User Interfaces IE 212: Computational Methods for Industrial Engineering.
# 1# 1 VBA Objects, Message Boxes as Functions What is an object in VBA? How do you move between design mode and run mode? How can you make a cell become.
Visual Basic for Applications Macro Programming For Microsoft Office.
VBA Lab 2 I ns.Samia Al-blwi. Visual Basic Grammar Object: Visual Basic is an object-oriented language. This means that all the items in Excel are thought.
ME 142 Engineering Computation I Custom Dialog Boxes.
ME 142 Engineering Computation I Debugging Techniques.
Tutorial 51 Programming Structures Sequence - program instructions are processed, one after another, in the order in which they appear in the program Selection.
Overview of VBA Programming & Syntax. Programming With Objects u Objects –Properties: attributes or characteristics of an object (e.g., font size, color,
Repetition Statements
GUI development with Matlab: GUI Front Panel Components GUI development with Matlab: Other GUI Components 1 Other GUI components In this section, we will.
ME 142 Engineering Computation I Using Subroutines Effectively.
OV Copyright © 2011 Element K Content LLC. All rights reserved.  Determine the Dialog Box Type  Capture User Input Creating an Interactive Worksheet.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 13 GUI Programming.
1 Scripting Languages VBScript - Recognized mainly by Internet Explorer only - Netscape does have a plug-in JavaScript - Recognized by Internet Explorer.
Macro’s Within excel. Most functionality can be driven from VBA VBA is the programming language that runs inside of excel. It uses visual basic as the.
ME 142 Engineering Computation I Input, Output & Documentation.
ME 142 Engineering Computation I Using Subroutines Effectively.
ME 142 Engineering Computation I Using Excel Arrays in Functions.
 2003 Prentice Hall, Inc. All rights reserved. Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing a Line of Text in a Web Page 7.3 Another JavaScript.
Introducing Dreamweaver. Dreamweaver The web development application used to create web pages Part of the Adobe creative suite.
Chapter 4 Getting Started with VBA. Subroutines Subroutine is the logical section of code that performs a particular task. Subroutine is also called a.
ME 142 Engineering Computation I Input, Output & Documentation.
Controlling Program Flow with Looping Structures
Visual Basic.net Functions. Function (Defined) A procedure that returns a value when called.
© by Pearson Education, Inc. All Rights Reserved.-Edited By Maysoon Al-Duwais 2.
Visual Basic. The Close Method The Close method is used to close a form. To close a form use the keyword Me to refer to the form. Me.Close()
Creating and Using Dialogs ● A dialog is a box that pops up and prompts the user for a value or informs them of something ● One way: directly create objects.
VBA Programming Functions and Decisions. If-Then-Else Structure used to consider alternatives If then --or-- If then Else End If.
Using a Database Access97 Please use speaker notes for additional information!
COMPREHENSIVE Access Tutorial 11 Using and Writing Visual Basic for Applications Code.
JavaScript Events Java 4 Understanding Events Events add interactivity between the web page and the user You can think of an event as a trigger that.
MsgBox, Input Box Functions Check boxes, radio button MsgBox, Input Box Functions Lab 3 3 Ismail M. Romi: PPU- IT Dept.
JavaScript Events. Understanding Events Events add interactivity between the web page and the user Events add interactivity between the web page and the.
Subroutines (PrArith, Math,projCP1, PrAdrProc, PrAdrProcFunc) Please use speaker notes for additional information!
Custom Dialog Box Alternatives And Dealing with FileNames Joanna Wyrobek.
Chapter 6 Controlling Program Flow with Looping Structures.
CIS 338: Dialog Boxes Dr. Ralph D. Westfall April, 2011.
Access VBA Programming for Beginners - Class 3 -
Topics Graphical User Interfaces Using the tkinter Module
Message, Input, Confirm, and Specialized Dialogs
Chapter 7 - JavaScript: Introduction to Scripting
JavaScript: Introduction to Scripting
Messages and Input boxes
Decisions and Conditions
Control Structures Part B - Message and Input Boxes
Chapter 7 - JavaScript: Introduction to Scripting
Chapter 7 - JavaScript: Introduction to Scripting
Chapter 7 - JavaScript: Introduction to Scripting
Presentation transcript:

ME 142 Engineering Computation I Interacting with Spreadsheets

Key Concepts Getting Input from a Message Box Returning Program Output from a Message Box

Getting Input/Returning Output  Via Functions Passing Information to a Function via an Argument List Returning Results from a Function to a Cell  Direct to/from a Spreadsheet Reading Data from a Spreadsheet Cell Returning Data to a Cell  Dialog Boxes InputBox Function MsgBox Function

InputBox Function

 Used to obtain a single value from the user MyVar = InputBox(prompt [, title] [,default]) Where Prompt – is the text displayed in the input box (required) Title – text displayed in the input box’s title bar (optional) Default – defines the default value (optional) MyVar – variable which will receive the input entered

InputBox Function  Examples Name = InputBox("Please enter your name: ","Name") MyNum = Val(InputBox("Enter the height:","Height"))

MsgBox Function

 Used to display information and get simple user input [MyVar =] MsgBox(prompt [, buttons] [,title]) Where Prompt – is the text displayed in the message box (required) Buttons – specifies buttons/icons appear in the message box (optional) Title – specifies the text displayed in the input box’s title bar (optional) MyVar – variable receiving value of mouse click button (optional)

Example Problem  Write a VBA program to calculate the surface area of a rectangular prism given the length, width, and height: As a Function, using the argument list As a Sub, reading from/writing to the spreadsheet As a Sub, using dialog boxes  Modify the programs to also calculate the volume

MsgBox Function  Examples MsgBox “Click OK to begin printing” Ans = MsgBox("Continue processing?", 4)

Values Used in MsgBox Function ValueConstant NameEnd Result vbOKOnly vbOKCancel vbAbortRetryIgnore vbYesNoCancel vbYesNo vbRetryCancel vbCritical vbQuestion vbExclamation vbInformation vbDefaultButton1 vbDefaultButton2 vbDefaultButton3 vbDefaultButton4 Displays OK Button only Displays OK and Cancel buttons Displays Abort, Retry, and Ignore buttons Displays Yes, No, and Cancel buttons Displays Yes and No buttons Displays Retry and Cancel buttons Displays Critical Message icon Displays Warning Query Icon Displays Warning Message icon Displays Information Message icon First button is default Second button is default Third button is default Fourth button is default

Values Returned by the MsgBox Function ValueConstant NameMeaning vbOK vbCancel vbAbort vbRetry vbIgnore vbYes vbNo User clicked OK User clicked Cancel User clicked Abort User clicked Retry User clicked Ignore User clicked Yes User clicked No

MsgBox Function  Example: Display Yes/No buttons with exclamation point icon, default of no Button = vbYesNo +vbExclamation + vbDefaultButton2 Ans = MsgBox("Continue Processing?",Button)

Review Questions

Review Question InputBox Function What type of data does the InputBox function return? A.Integer B.Real C.String D.May return any of the above

Homework Help ‘n Hints