Excel Visual Basic Variables, Part 1: Variable Types
Subscribe to continue reading
Subscribe to get access to the rest of this post and other subscriber-only content.
Subscribe to get access to the rest of this post and other subscriber-only content.
1. The Application Keyword Use “Application” to refer to Excel, e.g.: Application.ActivePrinter Name of the Active Printer.Application.Name Name of the program running (“Microsoft Excel”).Application.Path The path from which the program is running. 2. ActiveControl Instead of the name of a specific control (e.g. txtEdit), you can use the keyword ActiveControl. This will let your program refer…
This is from Microsoft Excel 2000 Visual Basic Help, with changes and additions. All arguments are passed to procedures by reference, unless you specify otherwise. This is efficient because all arguments passed by reference take the same amount of time to pass and the same amount of space (4 bytes) within a procedure regardless of…
Before Excel 2003, you could get a complete list of Visual Basic Functions by looking in Visual Basic Help > Contents > Functions. In Excel 2010, entering “Functions” into the Help Search box produces nothing useful. Using a specific category, e.g. “Math Functions”, may be more productive. Please be aware of what references to “Excel…
Windows stores program settings in the Registry, a Windows internal database. You can use this to remember previous user choices and use them as defaults the next time. We typically remember window positions, file paths, and other settings with the Registry. These three commands work with items stored in the Registry: SaveSetting appname, section, key,…
The macros you recorded in the previous post are stored in an Excel file. To edit it you use what looks like a separate program, the Visual Basic Editor. Open it with the Developer ribbon (Code group) > Visual Basic Editor (Alt+F11). You will find newly-recorded macros under Modules in the explorer on the left…
This is an excerpt from Microsoft Excel 2000 Visual Basic Help. 1. Objects and Collections An object represents an element of an application, such as a worksheet, a cell, a chart, a form, or a report. In Visual Basic code, you must first identify an object. Only then can you apply one of the object’s…