I have several ComboBoxes in an Excel VSTO Solution. The combos are windows forms combos.
The issue is that I’d like selected value in the combo to be repopulated when the user reopens the spreadsheet. Currently, I know that the values are saved with the spreadsheet, I know this I’ve ran into ClickOnce installer problems due to developing and testing on the same machine, and I can see the spreadsheet open, and the installer go to get the new version. During that time, I see the combo values I want.
However, once the customization installs and the spreadsheet initializes, the combos reset to default text values. I can think of a few ways to get around this, involving using cached data… Does anyone know if there is a simple way to keep the combos from resetting when the spreadsheet opens?
I don’t know if this is necessarily the best solution, but this is what I ended up doing.
I first embedded my combos into cells.
Then I created a sub to write the value of the Combo Text, back into the cell that the control resided in.
Finally a routine that writes the Cell Value back to the Combo.
To make it all work, I use the WorkBoook BeforeSave Event, and the WorkSheet.StartUp Event.
First
Then
If someone else knows of a better way to avoid this, let me know:)