Severe Problem with Updating .Value of ToggleButton Control on WorkSheet

New Contributor

I have an Excel Spreedsheet that is a Human Machine Interface an Boiler Control.  The spreadsheet has several toggle buttons such as on - off control, which outputs a Modbus byte to a programmable logic controller (PLC) through an Activex - MBAXP Modbus Master ActiveX Control.  The Workbook is communicating to the PLC every second, the status bytes being written to cells.  If I update the togglebutton status each time (ie togglebutton.value = on-off byte) the application will eventually slow, start hogging system memory then completely crash requiring a cnt-alt-del and restart.  What the heck is going on?


If MCold(10) <> MC(10) Then 'took out 11-1-18 then 11-23-18 added it back in because holy crap the memory started going ape**bleep** and crashing the **bleep**ing thing.
Application.EnableEvents = False 'added this **bleep** to keep other code from firing
If MC(10) Then
offon.Value = MC(10)
offon.Caption = "Boiler On"
offon.BackColor = RGB(0, 200, 0) '&HFF&
offon.Value = False
offon.Caption = "Boiler Off"
offon.BackColor = RGB(200, 0, 0) '&HC0C0C0
End If
Application.EnableEvents = True



I have a workaround that merely updates the .value when the button .value (MC(10)) changed (MCold(10). through an If Then statement.  



0 Replies