Название: Excel VBA Programming For Dummies
Автор: Dick Kusleika
Издательство: John Wiley & Sons Limited
Жанр: Программы
isbn: 9781119843092
isbn:
The VBA Help system describes every object, property, and method available to you, and also provides sample code. This is an excellent resource for finding out about VBA, and it’s more comprehensive than any book on the market. But it’s also very boring to read.
If you’re using Excel 2013 or later, you must be connected to the internet to use the VBA Help system (previous versions don’t have this requirement). You can, however, download the VBA Help system from Microsoft’s website. Do a web search for download excel VBA documentation, and you’ll find it.
If you’re working in a VBA module and want information about a particular object, method, or property, move the cursor to the word you’re interested in and press F1. In a few seconds, you’ll see the appropriate Help topic displayed in your web browser, complete with cross-references, and perhaps even an example or two.
Figure 4-3 shows part of a screen from the VBA Help system — in this case, for the Copy method of the Range object.
FIGURE 4-3: An example from VBA’s Help system.
Using the Object Browser
The VBE includes another tool known as the Object Browser. As the name implies, this tool lets you browse through the objects available to you. To access the Object Browser, press F2 when the VBE is active (or choose View ⇒ Object Browser). You see a window like the one shown in Figure 4-4.
The drop-down list at the top contains a list of all currently available object libraries. Figure 4-4 shows All Libraries. If you want to browse through Excel’s objects, select Excel from the drop-down list.
The second drop-down list is where you enter a search string. For example, if you want to look at all Excel objects that deal with borders, type border in the second field and click the Search button. (It has a pair of binoculars on it.) The Search Results window displays everything in the object library that contains the text border. If you see something that looks like it might be of interest, select it and press F1 for more information online.
FIGURE 4-4: Browsing for objects with the Object Browser.
Automatically listing properties and methods
Chapter 3 introduces you to a handy feature called Auto List Members. This feature provides a list of properties and methods as you type. Figure 4-5 shows an example for the Workbooks collection.
FIGURE 4-5: The Auto List Members feature helps you identify properties and methods for an object.
After typing the dot after workbooks, the VBE volunteers to help by displaying a list of properties and methods for that collection. Typing the letter (like the letter c) narrows the list to items that begin with that letter. With each letter you type, the VBE further narrows the list of choices. Highlight the item you need, press Tab, and voilà! You’ve eliminated some typing — and also ensured that the property or method was spelled correctly.
Конец ознакомительного фрагмента.
Текст предоставлен ООО «ЛитРес».
Прочитайте эту книгу целиком, купив полную легальную версию на ЛитРес.
Безопасно оплатить книгу можно банковской картой Visa, MasterCard, Maestro, со счета мобильного телефона, с платежного терминала, в салоне МТС или Связной, через PayPal, WebMoney, Яндекс.Деньги, QIWI Кошелек, бонусными картами или другим удобным Вам способом.