?
Solved

Excel ComboBox list contents not saving

Posted on 2003-03-17
7
Medium Priority
?
137 Views
Last Modified: 2010-05-03
I made a VB application which is using a lot of ComboBox that are populated from a database. It's like a big dynamic form that is going to be built on a server and distributed then to the clients. The problem is that the program is working quite alright, but when it comes to save, close, quit the document, everything is saving exept the ComboBoxes lists contents. Here is the function I used even if I don't think there is any error in it :

Private Function Destructor()
    xlwkbk.Worksheets.Item(1).Range("A1").Select
    xlwkbk.SaveAs ("C:\Test.xls")
    xlwkbk.Close
    adoConn.Close
    xlobj.Application.DisplayAlerts = True
    xlobj.Application.ScreenUpdating = True
    xlobj.Application.Visible = True
    xlobj.Quit
    If Not (adoConn Is Nothing) Then Set adoConn = Nothing
    If Not (xlSheet Is Nothing) Then Set xlSheet = Nothing
    If Not (xlwkbk Is Nothing) Then Set xlwkbk = Nothing
    If Not (xlobj Is Nothing) Then Set xlobj = Nothing
End Function

THNKS  !
0
Comment
Question by:Wiz_of_oz_777
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 8153363
AFAIK, you cannot do that!
Comboboxes always are populated at run time here, except that you save the contents of it in a range of worksheet and link that range to the combobox.
0
 

Author Comment

by:Wiz_of_oz_777
ID: 8154197
Richie Simonetti :
AFAIK, you cannot do that!
Comboboxes always are populated at run time here, except that you save the contents of it in a range of worksheet and link that range to the combobox.

Actually that is wrong. You are right that it wasn't featured in early versions of office (95 & 97) but It is working in Excel 2000 & XP. Since those versions are retro-compatible, it is possible to save the list itself with the rest of the file and to reopen it with 97 as long as it was created with 2000 & up excel versions.


0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 8154259
How do you populate the combo in first place?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 8154267
or better to say, how do populate them the first time?
0
 

Author Comment

by:Wiz_of_oz_777
ID: 8154489
Here's the code I used to populate every combobox:
         lrs_adoRS.Open as_SQL, adoConn, adOpenDynamic, adLockReadOnly
    lrs_adoRS.MoveFirst
    Do While Not (lrs_adoRS.EOF)
        i = i + 1
        ActiveSheet.OLEObjects(as_NomObjet).Object.AddItem _
        (lrs_adoRS.Fields(as_Field).Value)
        lrs_adoRS.MoveNext
    Loop
    lrs_adoRS.Close
0
 

Author Comment

by:Wiz_of_oz_777
ID: 8154613
I also used a simple copy & paste command to populate comboboxes that could be copied, to optimise the run time. But every combobox before I close, are correctly populated and visible... Just I didn't noticed Excel 95/97 could'nt save the lists populated from databases... after tests only XP (which is the only other I've tried) does.
0
 

Accepted Solution

by:
SpideyMod earned 0 total points
ID: 8154683
PAQ'd and all 50 points refunded.

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question