Solved

Populate a combobox list using excel 2000 data

Posted on 2004-09-01
2
137 Views
Last Modified: 2010-05-02
using an excel application object, how can you populate a combobox list using data that is specifically located in a maintained excel file?
0
Comment
Question by:japhet
2 Comments
 
LVL 2

Accepted Solution

by:
craigewens earned 50 total points
ID: 11950629
Private Sub Form_Load()

Dim ExcelSheet As Object
Set ExcelSheet = CreateObject("Excel.Sheet")
ExcelSheet.Application.Visible = True
ExcelSheet.Sheets("Sheet1").Cells(1, 1).Value = "Column 1, Row 1"
ExcelSheet.Sheets("Sheet1").Cells(2, 1).Value = "Column 1, Row 2"
ExcelSheet.Sheets("Sheet1").Cells(3, 1).Value = "Column 1, Row 3"
ExcelSheet.Sheets("Sheet1").Cells(4, 1).Value = "Column 1, Row 4"
ExcelSheet.Sheets("Sheet1").Cells(5, 1).Value = "Column 1, Row 5"
ExcelSheet.Sheets("Sheet1").Cells(6, 1).Value = "Column 1, Row 6"

For i = 1 To 6
    Combo1.AddItem ExcelSheet.Sheets("Sheet1").Cells(i, 1)
    DoEvents
Next i
Combo1.ListIndex = 0
ExcelSheet.Application.Quit
Set ExcelSheet = Nothing

End Sub
0
 

Author Comment

by:japhet
ID: 11970706
Thanks craigewens, I got the gist... =)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now