Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problems On Shutdown with Excel/VBA App
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problems On Shutdown with Excel/VBA App
Not so far, I have checked with other developers, & our
corporate IT to no avail. Hopefully someone here will know something about it. Tim -----Original Message----- 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 . . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problems On Shutdown with Excel/VBA App
I don't know what your code is doing when these
compilation errors happen, but it might help to disable application events while it is running, something like this: Application.EnableEvents = False [ code during which errors come up ] Application.EnableEvents = True -----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 . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Customized buttons cause Excel shutdown in Vista? | Excel Discussion (Misc queries) | |||
excel.exe has generated errors and will be shutdown by windows | Excel Discussion (Misc queries) | |||
Timed shutdown of spreadsheet | Excel Discussion (Misc queries) | |||
excel shutdown | Excel Discussion (Misc queries) | |||
UPS Shutdown script | Excel Discussion (Misc queries) |