VSTO: invoking on main Excel thread

前端 未结 3 836
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-13 20:26

I have a button on an Excel sheet which starts a new thread to do some processing. If I want to make any changes to Excel (e.g. write data to a cell using Worksheet.Ra

3条回答
  •  生来不讨喜
    2020-12-13 20:28

    Have you tried starting a BackgroundWorker from your button? This makes it very easy as the ProgressChanged and RunWorkerCompleted events will fire on the main thread.

    I haven't tried this in an Excel/VSTO environment but I don't see why it wouldn't work.

提交回复
热议问题