ListBox content not saved

  • Thread starter Thread starter Paolo Sardi
  • Start date Start date
P

Paolo Sardi

Hi,
I'm working with a ListBox embedded in a worksheet. I noticed that, saving
and closing the workbook, the content of my ListBox is not saved. Is there a
way to make Excel preserve the content of my ListBox?

Thank you.
 
try

Private Sub Workbook_Open()

ActiveSheet.CmbBoxDay.Clear
ActiveSheet.CmbBoxDay.AddItem ("1")
ActiveSheet.CmbBoxDay.AddItem ("2")
ActiveSheet.CmbBoxDay.AddItem ("3")
ActiveSheet.CmbBoxDay.AddItem ("4")
ActiveSheet.CmbBoxDay.AddItem ("5")
ActiveSheet.CmbBoxDay.AddItem ("6")
ActiveSheet.CmbBoxDay.AddItem ("7")

End Sub

put this code in the 'ThisWorkbook' page on the VB developer enviroment. and
then save

i used a combo box but the effect is the same.
 
The default action for controls is to unload from memory all property values
upon closing which includes closing a workbook. As Noob pointed out, they
can be reloaded automatically with the workbook open event or in the
initialize event of a form where applicable. However, to reload them with
the workbook open event, they would have to be saved in a file somewhere or
be calculated from data that is saved in a file and loaded with AddItem..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

ListBox Size and Screen Resolution 2
refresh listbox 2
inconsistent dir() behavior 1
Clear listbox 3
Stay on Active Sheet 2
How to set focus on an ActiveX ListBox 7
Refresh Listbox 2
Clearing a listbox 3

Back
Top