{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

LAB8 - • “As#” at the end of the code indicates the...

Info icon This 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)
Image of page 1

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

View Full Document Right 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
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
Image of page 3

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

View Full Document Right 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
Image of page 4
Syntax: Open “File_Location\File_Name.type” For Purpose As # Purpose: Input / Output
Image of page 5

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

View Full Document Right Arrow Icon
Image of page 6
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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern