+ Reply to Thread
Results 1 to 9 of 9

Out Of Stack Space Error With Toggle Button Clicks - One Problem Button

  1. #1
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Office 365
    Posts
    371

    Out Of Stack Space Error With Toggle Button Clicks - One Problem Button

    I have a userform that worked wonderfully without error when it was limited to functionality associated to one accessible toggle button ("OPS") to the user. Today, I introduced two more toggle buttons ("WEATHER"; "AVL"), each with click event handlers.

    When the user clicks on the first (oldest) button, and then clicks on one of the other two buttons, I receive an "Out of stack space error". If I restart, and this time select one of the two newer buttons, then go over the the first original button I get the same error. I do not get this error if I limit button pushes to the two newer buttons, but as soon as I introduce the first button ("OPS") I get the "Out of stack space error."

    When I debug, it brings me to this line of code (in red), which I don't think to be a major contributor because it had not created an error before the introduction of the two new buttons.
    Please Login or Register  to view this content.
    I will post some code that may or may not be relevant. I can certainly provide the file should anyone wish to pursue the problem outside of the code I've provided.

    The "OPS" toggle button click event code:
    Please Login or Register  to view this content.
    The "WEATHER" toggle button click event code:
    Please Login or Register  to view this content.
    The "AVL" toggle button click event code:
    Please Login or Register  to view this content.
    Any and all help is appreciated. This is resulting in a significant loss of full functionality in my project so I hope there is an easy fix.

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,960

    Re: Out Of Stack Space Error With Toggle Button Clicks - One Problem Button

    Post the workbook - to check your code would require a lot of extra work...
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Office 365
    Posts
    371

    Re: Out Of Stack Space Error With Toggle Button Clicks - One Problem Button

    Hello Bernie, thank you!
    With the hope that the problem can be identified and easily resolved, I've attached a link to download the file.

    REMOVED

    To recreate the error* open the file giving it permissions for the macros. It should open to sheet2 of the workbook and launch userform1.
    On userform1, click the "OPS" button. Follow that with a click of either the "WEATHER" or "AVL" buttons. This should create the out of stack space error*. Debug will take you to the line in my original post highlighted.
    For testing purposes (as this application relies on public variables loaded on workbook opening), simply click the smiley face on sheet2 to relaunch the userform. No need to close reopen the workbook.
    You will not get this error clicking only between the "WEATHER" and "AVL" buttons. As soon as you include "OPS" button at any point you get the error.

    * When I took this file home (vs. work) overnight, I did not immediately receive the "out of stack space error". Unfortunately, I did not manage to write down the message to share. With further testing, the "out of stack space error" eventually did crop up. The errors eventually made the system unstable. In fact, (and this is both unusual and scary), during testing when the error was encountered, EXCEL shut down. The computer was stable, but EXCEL closed. I had to restart Excel, but ... the file was no longer on my media. It was gone. I even did a data recovery of the thumbdrive with no luck. (Luckily I had the file backed up at work). The file must have become corrupted as I later found remnants of it ... ~$18-19 Materials Track.xlsm.
    Last edited by Jenn68; 01-11-2019 at 09:12 AM. Reason: Removed link.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Out Of Stack Space Error With Toggle Button Clicks - One Problem Button

    Jenny

    When you get the error have a look at the Call Stack (CTRL+L).
    If posting code please use code tags, see here.

  5. #5
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Office 365
    Posts
    371

    Re: Out Of Stack Space Error With Toggle Button Clicks - One Problem Button

    Oh, hello Norie!

    What should I be looking for there ...

    Capture.JPG

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Out Of Stack Space Error With Toggle Button Clicks - One Problem Button

    There's a bunch of calls to various click events that probably aren't needed.

    For example, the call to the Ops click event.

    Now the reason that event is being triggered is because you set the value of that control to False in the code for the Weather button.

    One way to prevent the problem would be to set mbEvents to False before you change the value of Ops and change mbEvents back to True afterwards.

  7. #7
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Office 365
    Posts
    371

    Re: Out Of Stack Space Error With Toggle Button Clicks - One Problem Button

    I figured it out.
    From within the toggle button changes, I was changing the value of the same button being pushed, so it was like it was in a constant loop of repeating states.

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Office 365
    Posts
    371

    Re: Out Of Stack Space Error With Toggle Button Clicks - One Problem Button

    Thanks Norie!!! Working so much better than it did last night.
    Thank you all for your interest in helping.

  9. #9
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,960

    Re: Out Of Stack Space Error With Toggle Button Clicks - One Problem Button

    Well, I just got to work - and I'm happy to hear that you got it all figured out.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. toggle button problem
    By Mad Moose in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-27-2015, 02:14 PM
  2. Combining separate button functions into one toggle button 2011 office for mac
    By voidcreativ in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-18-2015, 09:28 AM
  3. Toggle Button on/off problem
    By D_N_L in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-28-2014, 05:40 AM
  4. Toggle Button on Workbook Open - value is True but button not pressed?
    By excelnat in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 07-03-2014, 11:23 AM
  5. [SOLVED] Toggle Button 'State' Problem on Workbook Open
    By HangMan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-11-2012, 06:35 AM
  6. TOGGLE BUTTON on userform problem
    By davidm in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-24-2005, 05:40 AM
  7. Adding .xla button for Toggle Calculation Button
    By Mike in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-19-2005, 09:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1