Forum Discussion
rpbenz
Feb 05, 2019Copper Contributor
Severe Problem with Updating .Value of ToggleButton Control on WorkSheet
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&
Else
offon.Value = False
offon.Caption = "Boiler Off"
offon.BackColor = RGB(200, 0, 0) '&HC0C0C0
End If
Application.EnableEvents = True
MCold(10)=MC(10)
I have a workaround that merely updates the .value when the button .value (MC(10)) changed (MCold(10). through an If Then statement.
- rpbenzCopper Contributor
Hey Microsoft!!!! Why the heck isn't there any reply or response to this problem? Not only am I still seeing a severe problem with the updating .value of a toggleButton, but the newer MS Office is behaves even worse than before. The application works about a 1/2 hour before the Excel crashes!!!! rpbenz