JasonLiska
New Member
- Joined
- May 27, 2013
- Messages
- 6
Hello. This is my first post so thanks for your patience.
Prior to posting this thread I have exhausted many hours on multiple forum websites, Excel VBA books and other help resources. I'm spent.
COMPUTER/SOFTWARE: I'm working on a US Military PC (Windows 7 Enterprise, Service Pack 1 // MS Excel 2007).
BACKGROUND: My problem is in an automated calendar/scheduling system I built for my unit. It is an unprotected workbook that, when macros are enabled, becomes a nearly fully automated scheduling system. I protect the master file by automating backup copies for the general user to view without potential for corrupting the main program. The system ties into a large SMART Board which allows the scheduler to use tool menus (vbModeless UserForms). The goal is to keep a digital replacement for the standard large white board or dry erase board concepts that you see in most scheduling offices.
PROBLEM: I use multiple modeless userforms to allow automated manipulation of the calendar. I've built in quite a bit of redundancy but am unable to crack this one. The bottomline issue is that my userforms disappear when I loop through all worksheets in the workbook (hidden and visible) and delete extraneous worksheets (will explain later). The macro only causes the problem when run off a command button on one of the modeless userforms. All open userforms close regardless of where the code was initiated from.
EXAMPLE PROCESS: Scheduler uses a macro via command button on the scheduling tools userform to create or schedule an event within the calendar. The background code saves a copy of the calendar worksheet (prior to adding the event) and names the hidden sheet "UNDO". The event is scheduled and the "UNDO" command button on the Scheduling Tools userform highlights yellow letting the scheduler know they can undo the last action if the program result was not satisfactory. If the scheduler clicks the "UNDO" command button, the new calendar worksheet is hidden and renamed "REDO" while the "UNDO" worksheet is unhidden and renamed "CALENDAR" as it becomes the active calendar. Because of the large size of the calendar worksheet, it is necessary to remove unneeded UNDO/REDO worksheets prior to saving the file. (Before discovering this, the workbook was nearly 15 MB in size...and EXTREMELY slow...by removing unneeded worksheets I can keep the workbook under 4 MB). When the scheduler clicks the "SAVE" command button on the scheduling tools userform, a procedure is called prior to saving the workbook which deletes these unneeded worksheets. The code executes all the way through and then all active modeless userforms disappear.
FORMULAS: I loop through the worksheets looking at the worksheet names and deleting those that are no longer valuable to the program/workbook. For instance, if the Worksheet Name = "UNDO" then I delete it.
RESULTS: I run this same "clearing procedure" when the calendar is loaded...again, to ensure there are no extraneous worksheets hidden in the workbook. When executed during a calendar load or manual refresh, the procedure occurs prior to loading any userforms. There are no issues with the code here. The issue exists ONLY when there are already modeless userforms open (up to 4 different forms are possible at a given time). The same result, however, exists when the procedure is run from the userform command button and does not matter whether there is only 1 modeless form or all 4 open...they disappear. Additionally, I have performed extensive troubleshooting and found the problem to exist in the "clearing procedure" which loops through the worksheets and deletes the unneeded ones. The problem DOES NOT exist in the Workbook.Save execution nor does Excel crash or exhibit any problems beyond losing the userforms.
DESIRED RESULT: I want the Modeless UserForms to remain open following the procedure call to remove/delete unneeded worksheets.
ERROR MESSAGES: There are no error messages. In fact, the current result is similar to clicking the stop code button inside the VBA editor. The code, userforms, etc just quietly stop/quit and go away.
SPECIFIC CODE: If seeing specific lines of code would help you solve this issue, please let me know what you want to see. I may be able to answer your questions just based on all of the research and extensive trouble shooting.
Thank you in advance for reading this post and for attempting to solve this problem! I truly appreciate the effort!
Respectfully,
Jason
P.S. I'm posting this from my duty station in Germany...9 hour difference from the West Coast of the USA...so please be patient if awaiting a response from me. Thanks!
Prior to posting this thread I have exhausted many hours on multiple forum websites, Excel VBA books and other help resources. I'm spent.
COMPUTER/SOFTWARE: I'm working on a US Military PC (Windows 7 Enterprise, Service Pack 1 // MS Excel 2007).
BACKGROUND: My problem is in an automated calendar/scheduling system I built for my unit. It is an unprotected workbook that, when macros are enabled, becomes a nearly fully automated scheduling system. I protect the master file by automating backup copies for the general user to view without potential for corrupting the main program. The system ties into a large SMART Board which allows the scheduler to use tool menus (vbModeless UserForms). The goal is to keep a digital replacement for the standard large white board or dry erase board concepts that you see in most scheduling offices.
PROBLEM: I use multiple modeless userforms to allow automated manipulation of the calendar. I've built in quite a bit of redundancy but am unable to crack this one. The bottomline issue is that my userforms disappear when I loop through all worksheets in the workbook (hidden and visible) and delete extraneous worksheets (will explain later). The macro only causes the problem when run off a command button on one of the modeless userforms. All open userforms close regardless of where the code was initiated from.
EXAMPLE PROCESS: Scheduler uses a macro via command button on the scheduling tools userform to create or schedule an event within the calendar. The background code saves a copy of the calendar worksheet (prior to adding the event) and names the hidden sheet "UNDO". The event is scheduled and the "UNDO" command button on the Scheduling Tools userform highlights yellow letting the scheduler know they can undo the last action if the program result was not satisfactory. If the scheduler clicks the "UNDO" command button, the new calendar worksheet is hidden and renamed "REDO" while the "UNDO" worksheet is unhidden and renamed "CALENDAR" as it becomes the active calendar. Because of the large size of the calendar worksheet, it is necessary to remove unneeded UNDO/REDO worksheets prior to saving the file. (Before discovering this, the workbook was nearly 15 MB in size...and EXTREMELY slow...by removing unneeded worksheets I can keep the workbook under 4 MB). When the scheduler clicks the "SAVE" command button on the scheduling tools userform, a procedure is called prior to saving the workbook which deletes these unneeded worksheets. The code executes all the way through and then all active modeless userforms disappear.
FORMULAS: I loop through the worksheets looking at the worksheet names and deleting those that are no longer valuable to the program/workbook. For instance, if the Worksheet Name = "UNDO" then I delete it.
RESULTS: I run this same "clearing procedure" when the calendar is loaded...again, to ensure there are no extraneous worksheets hidden in the workbook. When executed during a calendar load or manual refresh, the procedure occurs prior to loading any userforms. There are no issues with the code here. The issue exists ONLY when there are already modeless userforms open (up to 4 different forms are possible at a given time). The same result, however, exists when the procedure is run from the userform command button and does not matter whether there is only 1 modeless form or all 4 open...they disappear. Additionally, I have performed extensive troubleshooting and found the problem to exist in the "clearing procedure" which loops through the worksheets and deletes the unneeded ones. The problem DOES NOT exist in the Workbook.Save execution nor does Excel crash or exhibit any problems beyond losing the userforms.
DESIRED RESULT: I want the Modeless UserForms to remain open following the procedure call to remove/delete unneeded worksheets.
ERROR MESSAGES: There are no error messages. In fact, the current result is similar to clicking the stop code button inside the VBA editor. The code, userforms, etc just quietly stop/quit and go away.
SPECIFIC CODE: If seeing specific lines of code would help you solve this issue, please let me know what you want to see. I may be able to answer your questions just based on all of the research and extensive trouble shooting.
Thank you in advance for reading this post and for attempting to solve this problem! I truly appreciate the effort!
Respectfully,
Jason
P.S. I'm posting this from my duty station in Germany...9 hour difference from the West Coast of the USA...so please be patient if awaiting a response from me. Thanks!