tailieunhanh - Vẽ kỹ thuật với Autocad 2006 P2

In this example, use a question mark (?) to ask the VBAIDE to tell you a variable’s value. To set a variable’s value in the Immediate window, type the statement just as you would in the Code window. Figure 1-10 shows how it’s done. | 8 CHAPTER 1 THE VBA INTEGRATED DEVELOPMENT ENVIRONMENT VBAIDE In this example use a question mark to ask the VBAIDE to tell you a variable s value. To set a variable s value in the Immediate window type the statement just as you would in the Code window. Figure 1-10 shows how it s done. Figure 1-10. Setting a variable in Immediate window Note You can t declare variables in the Immediate window. Also a variable s scope and valid VBA commands in the Immediate window are equally important. Chapter 2 covers variable scope. The Options Dialog Box The Options dialog box shown in Figure 1-11 lets you customize the IDE s look and feel including syntax color scheme source code font and tab spacing. To open the Options dialog box choose Tools Options. This section covers the most commonly used options. Figure 1-11. The Options dialog box For most developers the default settings are fine. However you should consider changing two settings on the Editor tab Auto Syntax Check and Require Variable Declaration. When the Auto Syntax Check option is checked syntax errors in your code generate an error message similar to Figure 1-12. CHAPTER 1 THE VBA INTEGRATED DEVELOPMENT ENVIRONMENT VBAIDE 9 As you begin to develop more complex applications and reuse lines of code from other places in your application these error messages will become a nuisance. Any time you move the cursor off the offending line of code you get one of these error messages. But if you uncheck Auto Syntax Check the VBAIDE notifies you of errors by changing the color of the offending line of code to red. The Require Variable Declaration option is unchecked by default meaning that the VBAIDE does not require that you properly declare your variables before you use them. This isn t much of a concern when you write a simple macro but when you start developing larger and more complex applications you ll find this option indispensable. Checking this option forces you to think about each variable and its data type. When .

TỪ KHÓA LIÊN QUAN