Wbsaveas dtempsalesbook this code will run even more

This preview shows page 467 - 469 out of 490 pages.

wb.SaveAs "d:\temp\SalesBook" This code will run even more slowly than the previous code, which, in turn, is slower than the first version. Thus, we have three versions of Automation: Using the New keyword syntax (requires an object library reference) Using CreateObject and specific object variable declarations (requires an object library reference) Using CreateObject with generic As Object declarations (does not use an object library reference) These versions of automation are sometimes referred to by the names very early binding , early binding , and late binding, respectively (although you may hear these terms used somewhat differently). These terms refer to the time at which VBA can associate (or bind ) the object, property, and method names in our code to the actual addresses of these items. In very early binding, all bindings are done at compile time by VBA—that is, before the program runs. In early binding, some of the bindings are done at compile time and others are done at run time. In late binding, all bindings are done at run time. The issue is now evident. The more binding that needs to be done at run time, the more slowly the program will run. Thus, very early binding is the most efficient, followed by early binding, and then late binding.
454 Appendix F. High-Level and Low-Level Languages In this appendix, we'll examine the position of Visual Basic as a programming language by taking a somewhat closer look at high-level and low-level languages, with some examples for comparison. A low-level language is characterized by its ability to manipulate the computer's operating system and hardware more or less directly. For instance, a programmer who is using a low-level language may be able to easily turn on the motor of a floppy drive, check the status bits of the printer interface, or look at individual sectors on a disk, whereas these tasks may be difficult, if not impossible, with a high-level language. Another benefit of low-level languages is that they tend to perform tasks more quickly than high-level languages. On the other hand, the power to manipulate the computer at a low level comes at a price. L ow- level languages are generally more cryptic—they tend to be farther removed from ordinary spoken languages and are therefore harder to learn, remember, and use. High-level languages (and application-level languages, which many people would refer to simply as high-level languages) tend to be more user-friendly, but the price we pay for that friendliness is less control over the computer and slower running programs. To illustrate, consider the task of printing some text. A low-level language may only be able to send individual characters to a printer. The process of printing with a low-level language might go something like the following: 1. Check the status of the printer.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture