View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bryce K. Bryce K. is offline
external usenet poster
 
Posts: 2
Default Problems On Shutdown with Excel/VBA App

I have a somewhat similar problem. The macro works fine
when open, but as soon as I close it and reopen the file,
the macro doesn't work properly. Has anyone been able to
help you with this issue?

Thanks,
Bryce

-----Original Message-----
I have been writing an app to automate some of the
accounting processes at work and am using Excel as a

basis
for this app. I have created a front page which is
basically an Excel form with various buttons and combo
boxes on it to allow the user to move between different
parts of the program without having to use it in an excel
like way and to run various bits of VB code.
The problem I am having is when the program shuts down:
The user presses the Exit button (I have disabled the
normal close procedure to ensure the program data is up

to
date before it is closed) to exit and then I get a series
of four Compilation Errors that a variable has not been
defined. The variable in question is the name of one of
the controls on the front page and does exist (all of the
code works fine when the program is open). If I reference
the control explicitly using Sheets("Sheet
Name").ControlName then the problem cascades onto another
control until I reference them all explicitly at which
time I get told that the object do not exist. I have
Option Explicit set in all modules.

What I assume is happening is this:
When the program closes down, the sheet containing the
front page is removed from memory and THEN it tries to
compile allthe code again, resulting in the compilation
errors. What I don't know is WHY this happens and how I
can solve it. Can any one help out?

Thanks In Advance,

Tim
.