Quote:
> I am a new VB programer, I need load data from a Excel sheet to combo
> boxes(one column at one combo box), I don't know how to do this. Please
> help!
DAO method - substitute your correct path/file name, a correct sheet
name (be sure to add $ after sheet name), and a correct Column name. If
your sheet does not have Column names in the first cell, you refer to
the correct column with recordset .Fields(index) notation. Note that
Excel 8.0 is for Excel97 worksheets
Dim dbXL As Database
Dim rsXL As Recordset
'open XL workbook as database, Exclusive=False, ReadOnly=True
Set dbXL = OpenDatabase("C:\YourFolder\Your.xls", _
False, True, "Excel 8.0")
'open recordset on a sheet
Set rsXL = dbXL.OpenRecordset("SomeSheetName$")
'loop thru records, adding values from selected field to ComboBox as
long as
' value in a cell is not NULL
With rsXL
Do Until .EOF
If Not (IsNull(![SomeColumnName])) Then
cboComboBoxName.AddItem ![SomeColumnName]
End If
.MoveNext
Loop
.Close
End With
dbXL.Close
Set dbXL = Nothing
--
Jim in Cleveland
If you're writing to me, in my address
change "REAL_Address.see.below" to "worldnet.att.net"
"What's so funny 'bout peace, love & understanding?"
- Nick Lowe