You will need
  • - Microsoft Office Excel.
Instruction
1
Start Microsoft Office Excel. If necessary, create a new document. To do this, press Ctrl+N or click "File" and select "New...". Then click "blank workbook" in the "Create book".
2
Open the Visual Basic editor window. To do this, press Alt+F11 or select the "Visual Basic Editor" under the "Macro" menu "tools". There you will see a project panel that displays the object tree of the Excel workbook, and it contains forms, modules and class modules.
3
Create forms if necessary. In the main menu, click on Insert and then UserForm. In the Forms tab of the project panel to add a new item. When you create the form will automatically open. Mouse move controls from the Toolbox pane to the form window. Change their size and position. After the mouse selection to change their properties in the Properties panel. Save the form by pressing Ctrl+S.
4
Create the desired number of modules or class modules. To do this, choose the items Module or Class Module in the Insert tab of the main menu. Open the editing window of the code of the desired modules or forms by double-clicking on relevant elements in the project window.
5
Add the Declaration of classes in the class modules. Define them using the Class keyword:
Class CSampleClass
End Class
6
To define classes, add methods, and modules - procurement functions and procedures. Functions are declared using the Function keyword followed by a name and a set of parameters, separated by commas, enclosed in parenthesis. For example:
Function SampleFunction(a, b, c)
End Function
Similarly (only with a Sub keyword) shows up procedures:
Sub SampleProcedure(a, b)
End Sub
7
Declare class members as well as global and local (functions and methods) variables. To do this, use the Dim...As (after the As keyword specifies the type of the variable). For example, the variable Declaration oWB that holds a reference to the workbook object might look like this:
Dim oWB As Excel.Workbook
Putting the dimension in parentheses, you can declare the array:
Dim aWBooks(10) As Excel.Workbook
8
Implement the algorithm of the program, amending the code of functions, procedures, methods, classes. Use the structure of a Visual Basic control to control the execution flow. Work with their own data structures, objects created forms embedded Excel objects.