Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 334
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Please help me... with Case Structure LSB M Excel Worksheet Functions 3 July 12th 06 09:31 AM
A VB problem with a if structure filo666 Excel Programming 1 November 21st 05 09:59 PM
if structure help filo666 Excel Programming 4 March 1st 05 08:37 PM
Tree Structure ExcelMonkey[_190_] Excel Programming 4 February 25th 05 02:07 AM
Structure of If...Else in VBA John Wilson Excel Programming 2 July 30th 03 04:33 AM


All times are GMT +1. The time now is 01:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"