View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
stainless[_2_] stainless[_2_] is offline
external usenet poster
 
Posts: 7
Default Defining public/global variables in more than one place

Using Excel 2003 (hopefully will persuade my company to allow us to upgrade our excel reports to 2010 at some point!)

I am trying to standardise the code in our executables to make coding/maintenance easier and have come up with the following idea:

1. Our Excel reports have a simple Auto_Open module that will be the first piece of code in every report we have and this has 1 public variable plus one actual command to call another module sub called Main_Processing. This other module will contain the report relevant logic.

2. This public variable defined in the Auto_Open module is a string defining the environment the code runs in such as Test, Development and thus can be altered simply for each environment. Lower level code uses this to pick up data files from the correct place for that environment.

3. This is the part my question relates to. Can the Main_Processing module also have public variables that are used in lower level sub routines and functions? So far, I have only defined global variables in one place at the top level, so the question is really about scope of lower level variables.

Cheers