How to create a combobox with my DB in Excel?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dizo
    New Member
    • Jun 2012
    • 3

    How to create a combobox with my DB in Excel?

    Hello
    I am creating a new software with visual studio 2010 using the program language visual basic .NET, well in that software I create a new file in excel 2007, my question is because I do not know how I can create a combobox with data of my database inside, I will be appreciate your help a lot, thank for your time.
    To create the combobox I use the next code in a button of my windows form, It actually is an adaptation of the code shared by sammyB (http://bytes.com/topic/net/answers/614371-using-vb-net-dynamically-create-excel-activex-controls):
    Code:
        Dim xlApp As Excel.Application
            Dim xlBook As Excel.Workbook
            Dim xlSheet As Excel.Worksheet
            Dim xlcombobox As Excel.OLEObject
            Dim iStartLine As Long
    
            xlApp = New Excel.Application
            xlApp.Visible = True
            xlBook = xlApp.Workbooks.Add
            xlSheet = xlBook.ActiveSheet
    
    
            xlcombobox = xlSheet.OLEObjects.Add(ClassType:="Forms.combobox.1", _
             Link:=False, DisplayAsIcon:=False, Left:=1, Top:=25, Width:=72, Height:=24)
            xlcombobox.Name = "clientes"
    I don’t know how to continue help me please
Working...