Backroundworker and Thread Sleep

Add-in Express™ Support Service
That's what is more important than anything else

Backroundworker and Thread Sleep
Excel Problems with BGW without Thread.Sleep 
Subscribe
Michael Kaden




Posts: 20
Joined: 2023-10-25
Hello Andrei,

hope you are well. My Excel AddIn is running well. In one Sub I do loops to solve problems and I use the Backgroundworker which speeds up this process considerable. Up to now this worked very well. Without changing any code I now observe 2 problems when the sub with the BGW is called which have not been there before.

1.) When I input a manual value in a cell which uses the AddIn and the BGW the sheet is locked I have to unlock it to continue.

2.) From time to time the Workbook freezes or shut down and opens immediately the same workbook.

When I put a thread.sleep(100) in that Sub before the BGW is called, the problem seems to go away.

Do you have any explanations for this behavior and what is the most stable remedy?

Thank you and kind regards.

Michael
Posted 12 Apr, 2025 17:32:56 Top