LAB8 - • “As#” at the end of the code indicates the alias that will be used for working with the file on VBA • Ex Open “C\My

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Multidimensional Arrays (Ch. 9, pp. 202 – 204) File Handling (Ch. 10, pp. 233 – 242) Population modeling (Project 6) Review (Ch. 9, pp. 205 – 213)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Arrays with more than 1 index A 2-D array can be visualized as a collection of rows and columns Excel worksheets, Matrices are some examples of 2-D arrays ID No. 1 156 2 168 3 147 4 139 1 2 1 1 2 2 3 4 Column (j) Rows (i) 1-D Array 2-D Array
Background image of page 2
Work with files other than excel Code to take-in (input) data from a file (file input) and print (output) data to the file (file print) Can work with text files, word files, etc. File handling also used for complex programming techniques
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Open file for Input (and specify an alias) Get the Input from the file into VBA variables Close File Perform calculations on VBA Open file for Output (specify alias) Print output from VBA into the external file Close file
Background image of page 4
Syntax: Open “File_Location\File_Name.type” For Purpose As # Purpose: Input / Output
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 6
Background image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: • “As #” at the end of the code indicates the alias that will be used for working with the file on VBA • Ex.: Open “C:\My Documents\Example.txt” For Input As #1 • ActiveWorkbook.Path b Place file in the same directory as the current VBA program Ex.: Open ActiveWorkbook.Path & “\Example.txt” For Input As #1 • If your current VBA file is saved at “C:\My Documents” then, ActiveWorkbook.Path = “C:\My Documents” • Input operation syntax: Input Alias, Variable_Name • Output operation syntax: Output Alias, Variable_Name • Syntax to close a file: Close Alias • Always remember to open the file before you use it in your program and to close the file once all the operations relating to that file are completed • Specify the correct (exact) file location • Open file separately for input and output operations...
View Full Document

This note was uploaded on 11/28/2011 for the course ENGR 1412 taught by Professor Staff during the Fall '08 term at Oklahoma State.

Page1 / 7

LAB8 - • “As#” at the end of the code indicates the alias that will be used for working with the file on VBA • Ex Open “C\My

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online