BBCrawford
New Member
- Joined
- Jun 22, 2007
- Messages
- 11
Excel 2016 ProPlus (but the problem occurs in Excel 2013 as well)
I have a userform with a number of Frames on it that that are layered on top of a "baseline" frame that has command buttons on it for selecting the Frames to be overlayed, exposing additional controls to the user. When I activate the myuserform I properly size the baseline frame and set all the other frames widths to 0 (their height is made=baseline). When the user selects the required action the appropriate frame is expanded overtop of part of the baseline frame exposing the additional controls.
Because I am switching frames back and forth (ie to appear/not appear by setting width to zero or to the overlap width) I need to keep track of the currently active frame so I know which one to set width =0 when the user selects the next frame. To handle this initially I have to set a "current frame" to the "baseline" frame
This "CurrentFrame" is set in the activate event of the form (in the forms code):
-in the userform's declaration:
Public CurrentFrame as msforms.Frame then in the activate event
SET CurrentFrame=myuserform.BaselineFrame
then after any new frame selection I set the (in the command button click event (actually in a common Sub))
This all works wonderfully ... until it doesn't..
I can test this 10-20+ times (or sometimes just once) and it will work with any combination of closing and opening the form and closing and opening the WB and opening and closing Excel.
At some point when opening (activating) the form it will fail on the;
In the debugger if, at the error, I display the BaseLineFrame.name it is no longer the name of the Frame but the name of a commandbutton on the BaseLineFrame (if I remove that Button from the BaseLineFrame it just changes to another button)
I have tried opening/closing the form with Show/Hide & Show/Unload but the same.
Periodically when I get this failure and I then close the WB I will get an "Out of Memory" error.
Also, there is another WB open at the same time (hidden) that this WB updates as part of its normal processing (neither WBs are particularly large)
Help desperately needed
Thanks
Brain
I have a userform with a number of Frames on it that that are layered on top of a "baseline" frame that has command buttons on it for selecting the Frames to be overlayed, exposing additional controls to the user. When I activate the myuserform I properly size the baseline frame and set all the other frames widths to 0 (their height is made=baseline). When the user selects the required action the appropriate frame is expanded overtop of part of the baseline frame exposing the additional controls.
Because I am switching frames back and forth (ie to appear/not appear by setting width to zero or to the overlap width) I need to keep track of the currently active frame so I know which one to set width =0 when the user selects the next frame. To handle this initially I have to set a "current frame" to the "baseline" frame
This "CurrentFrame" is set in the activate event of the form (in the forms code):
-in the userform's declaration:
Public CurrentFrame as msforms.Frame then in the activate event
SET CurrentFrame=myuserform.BaselineFrame
then after any new frame selection I set the (in the command button click event (actually in a common Sub))
CurrentFrame.width =0
SET CurrentFrame = myuserform.newFrame
CurrentFrame.width=400
SET CurrentFrame = myuserform.newFrame
CurrentFrame.width=400
This all works wonderfully ... until it doesn't..
I can test this 10-20+ times (or sometimes just once) and it will work with any combination of closing and opening the form and closing and opening the WB and opening and closing Excel.
At some point when opening (activating) the form it will fail on the;
SET CurrentFrame=myuserform.BaselineFrame with a "Type Mismatch" error
In the debugger if, at the error, I display the BaseLineFrame.name it is no longer the name of the Frame but the name of a commandbutton on the BaseLineFrame (if I remove that Button from the BaseLineFrame it just changes to another button)
I have tried opening/closing the form with Show/Hide & Show/Unload but the same.
Periodically when I get this failure and I then close the WB I will get an "Out of Memory" error.
Also, there is another WB open at the same time (hidden) that this WB updates as part of its normal processing (neither WBs are particularly large)
Help desperately needed
Thanks
Brain