ME 142 Engineering Computation I Input, Output & Documentation.

Slides:



Advertisements
Similar presentations
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
Advertisements

Office 2003 Post-Advanced Concepts and Techniques M i c r o s o f t Excel Project 7 Using Macros and Visual Basic for Applications (VBA) with Excel.
Using Macros and Visual Basic for Applications (VBA) with Excel
Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
Tutorial 12: Enhancing Excel with Visual Basic for Applications
IS 1181 IS 118 Introduction to Development Tools VB Chapter 06.
String Variables Visual Basic for Applications 4.
Exploring Office Grauer and Barber 1 Creating More Powerful Applications: Introduction to VBA(Wk9)
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.
Macros Tutorial Week 20. Objectives By the end of this tutorial you should understand how to: Create macros Assign macros to events Associate macros with.
Chapter 7: Sub and Function Procedures
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.
Adding Automated Functionality to Office Applications.
Microsoft Office © Copyright William Rowan Objective By the end of this you will have being given a brief introduction to: Microsoft Word Microsoft.
COMPREHENSIVE Excel Tutorial 8 Developing an Excel Application.
Exploring Microsoft Excel 2002 Chapter 8 Chapter 8 Automating Repetitive Tasks: Macros and Visual Basic for Applications By Robert T. Grauer Maryann Barber.
WORKING WITH MACROS CHAPTER 10 WORKING WITH MACROS.
Microsoft Office 2007 Access 2007 Chapter 9 Administering a Database System.
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.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Saeed Ghanbartehrani Summer 2015 Lecture Notes #4: Working with Variables and User Interfaces IE 212: Computational Methods for Industrial Engineering.
Project 9 Using Visual Basic for Applications (VBA) to Customize and Automate Excel Jason C. H. Chen, Ph.D. Professor of Management Information Systems.
Finish Decryption 25 minutes. Introduction to VBA Day 4.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. WORD 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 22 Macros.
PMS /134/182 HEX 0886B6 PMS /39/80 HEX 5E2750 PMS /168/180 HEX 00A8B4 PMS /190/40 HEX 66CC33 By Adrian Gardener Date 9 July 2012.
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 Microsoft Office Excel Copyright © 2008 Pearson Prentice Hall. All rights reserved
Click your mouse to continue. Ways to Merge Data When you have finished editing your main document and inserting the merge fields, you have several choices.
1 Performing Spreadsheet What-If Analysis Applications of Spreadsheets.
McGraw-Hill/Irwin The Interactive Computing Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Excel 2002 Lesson 1 Introduction.
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.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
MS-Word XP Lesson 9. Mail Merge The Mail Merge feature combines a list of data, typically name and address that is contained in one file with a document.
ME 142 Engineering Computation I Custom Dialog Boxes.
Click your mouse to continue. Creating a New Mail Merge Document When you need to create a form letter but do not have an existing main document, you can.
Tutorial 51 Programming Structures Sequence - program instructions are processed, one after another, in the order in which they appear in the program Selection.
Exploring Microsoft Access Chapter 8 Creating More Powerful Applications: Introduction to VBA.
Chapter 9 Macros And Visual Basic For Applications.
ME 142 Engineering Computation I Exam 2 Review VBA.
Spreadsheet Data Tables Data Table 1 allows you to change one input variable’s value at a time and record the impact that the input assumption has on several.
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.
1 Scripting Languages VBScript - Recognized mainly by Internet Explorer only - Netscape does have a plug-in JavaScript - Recognized by Internet Explorer.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
ME 142 Engineering Computation I Using Subroutines Effectively.
 2003 Prentice Hall, Inc. All rights reserved. Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
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.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 3 Building an Application in the Visual Basic.NET Environment.
© 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()
VBA Programming Functions and Decisions. If-Then-Else Structure used to consider alternatives If then --or-- If then Else End If.
Working with the Window Object JavaScript considers the browser window an object, which it calls the window object.
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.
ME 142 Engineering Computation I Interacting with Spreadsheets.
MsgBox, Input Box Functions Check boxes, radio button MsgBox, Input Box Functions Lab 3 3 Ismail M. Romi: PPU- IT Dept.
XP Adding Headers and Footers Text that is printed at the top of every page is called a header A footer is text that is printed at the bottom of every.
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.
COMPREHENSIVE Excel Tutorial 12 Expanding Excel with Visual Basic for Applications.
Excel Tutorial 8 Developing an Excel Application
Access VBA Programming for Beginners - Class 3 -
Microsoft Office Illustrated
Exploring Microsoft Excel
Messages and Input boxes
Presentation transcript:

ME 142 Engineering Computation I Input, Output & Documentation

Key Concepts Documentation Getting Program Input and Returning Program Output Linking a Program to a Button

Header Example ‘Purpose: ‘This program computes the hypotenuse of a ‘triangle, given the legs ‘Input: ‘A, B – legs of the triangle ‘Output: ‘Hyp – hypotenuse of the triangle ‘Author: GS Miller ‘Date Created: 10/15/2008 ‘Limitations: None

Improving Program Readability  Include Header  Use descriptive variable names  Use indentation and blank lines to clarify structure  Add other comments as appropriate

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

Getting Input/Returning Output  VBA Supports 2 types of programs Functions Subprograms or Subroutines  Functions typically receive all of their input through the parameter list and write their output to the cell from which the function was launched  Subprograms may read/write directly to/from cells Sub MyPgm() … End Sub

Using the Cells command to Read/Write Spreadsheet Data  Data may be read from a spreadsheet cell using the cells command as shown below: variable = Cells(row,col) row,column – the address of the cell to be read variable – name of variable which receives the contents of the cell

Using the Cells command to Read/Write Spreadsheet Data  Data may be written to a spreadsheet cell using the cells command as shown below: Cells(row,col) = variable row,column - the address of the cell to be written variable – variable to be written to the cell

Using the Cells command to Read/Write Spreadsheet Data  Example: Sub Square() A=cells(2,1) B=A^2 cells(2,2)=B End Sub

Linking a Program to a Button

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)

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

Common MsgBox Function Constants Constant NameEnd Result vbOKOnly vbOKCancel vbAbortRetryIgnore vbYesNoCancel vbYesNo vbRetryCancel 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