URGENT-MAIL 
Author Message
 URGENT-MAIL
Hi All,
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!

Thank you in advance

Cindy



Tue, 23 Apr 2002 03:00:00 GMT
 URGENT-MAIL

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



Wed, 24 Apr 2002 03:00:00 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. URGENT MAIL

2. SQL Server 2000 Mail URGENT

3. Urgent - SQL Mail Problem

4. MAIL CONFIG (Urgent)

5. SQL MAIL WITH A SMTP SERVER - URGENT

6. MAIL CONFIG (Very urgent)

7. SQL Mail Error, Urgent Please

8. SQL mail Win2k with SQL 2k :: URGENT PLEASE

9. SL mail on 2000 failed ! Urgent help needed

10. (urgent)Sending mail automatically

11. Urgent Pls e-mail shot

12. URGENT: MSMAPI32.OXC Mail Error!


 
Powered by phpBB® Forum Software