Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
vba structure
Is there a logical way to structure the code behind the excel program. Such
as top down design. Does Excel within the Windows environment drop memory requirements as a section is no longer needed. One use logic being at the bottom of the structure, and the more often, many times use at the top. Anybody out there that knows the real skinny on this question? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
vba structure
You can write your code as a single procedure. However, if you have a
lengthy program, it is advisable to break the code into smaller bits. You can modularize your code with VBA. Assume you have a main control code called MainControl: Sub MainControl() macro1 macro2 macro3 macro4 macro5 End Sub The main sub procedure calls the subroutines in the order you want them to run. As each subroutine completes, the varaiables in that routine are released from memory and the control reverts to the main sub. The above illustration does not show it, but you can have additional code in the main procedure to further process any results of the subroutine just completed or to prepare for the routine about to run. You can also call procedures back and forth between subroutines in the same manner shown for the main procedure. Within the same workbook, just enter the procedure name. Between workbooks you must use Call, i.e. Call Macro1. Call tells VBA to look outside the current workbook. VBA compiles on the fly so that is a consideration for memory use. It stores your variables as they are declared in your code, but not before they are declared except as the compiler finds them and the built in program evaluates them and assigns them. Any variables declared as public or those in the main procedure are held in memory for the duration of the main procedure. That's the nickel tour. "Rick" wrote: Is there a logical way to structure the code behind the excel program. Such as top down design. Does Excel within the Windows environment drop memory requirements as a section is no longer needed. One use logic being at the bottom of the structure, and the more often, many times use at the top. Anybody out there that knows the real skinny on this question? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
vba structure
This site has some good basic information about VBA. Check out Item 2. on
Macros for the vocabulary. It gives the basic structure by describing the components of VBA as definitions. "Rick" wrote: Is there a logical way to structure the code behind the excel program. Such as top down design. Does Excel within the Windows environment drop memory requirements as a section is no longer needed. One use logic being at the bottom of the structure, and the more often, many times use at the top. Anybody out there that knows the real skinny on this question? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
vba structure
Guess I had a senior moment there.
This site has some good basic information about VBA. Check out Item 2. on Macros for the vocabulary. It gives the basic structure by describing the components of VBA as definitions. http://www.excel-vba.com/excel-vba-contents.htm "Rick" wrote: Is there a logical way to structure the code behind the excel program. Such as top down design. Does Excel within the Windows environment drop memory requirements as a section is no longer needed. One use logic being at the bottom of the structure, and the more often, many times use at the top. Anybody out there that knows the real skinny on this question? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Please help me... with Case Structure | Excel Worksheet Functions | |||
A VB problem with a if structure | Excel Programming | |||
if structure help | Excel Programming | |||
Tree Structure | Excel Programming | |||
Structure of If...Else in VBA | Excel Programming |