LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Excel loses mind clearing VBA global variables

Ive inherited a large Excel and Access application that has been grown over
time by a number of individual developers. The major issue I need to resolve
is the use or abuse of global variables. This application uses VBA global
variables rather than storing data on hidden worksheets. Also, all data is
loaded into arrays €“ VBA global variables €“ from an Access database when the
application starts. There are many places in the code that checks that the
global variables are still populated and if not then the application is
automatically restarted.

I can not redesign and rewrite this application from scratch. I have to find
ways to mitigate the risk of a restart. I need a list of things, events, etc.
that can cause Excel to clear VBA global variables so I can €śdance around€ť
these €śthings.€ť

Inserting objects onto a sheet may be one thing. Adding and deleting sheets
may be another. My problems began with using VBA to insert a combo box onto a
sheet right after code that inserted action buttons. I now am using a
template and have removed the code that inserts these objects. VBA adds a new
sheet using the template. All the objects and formulae work. The data in the
global variables is present and is inserted into the new sheet. Now when I
click the menu option to do the same process again, all the global variables
are cleared. The first step of this process looks for sheets left from
previous executions and deletes them. This appears to be the place where
Excel resets. Also, Excel announces at the point where a sheet is to be
deleted that break mode can not continue and provides an option to continue
code execution or end. Is there a way to preserve Excels state through sheet
deletion or should I go through the application and see about reusing sheets
rather than deleting them?

 
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
Global Variables Karen53 Excel Programming 12 April 16th 08 07:14 PM
Global Variables in Excel VBA [email protected] Excel Programming 6 November 6th 06 11:21 AM
Global Variables [email protected] Excel Programming 0 July 7th 06 10:53 AM
global variables Mike Archer Excel Programming 4 May 3rd 06 07:33 PM
Global Variables Ernst Guckel[_4_] Excel Programming 2 May 7th 05 11:10 PM


All times are GMT +1. The time now is 03:09 PM.

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"