By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,619 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

How to create a combobox with my DB in Excel?

P: 3
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):
Expand|Select|Wrap|Line Numbers
  1.     Dim xlApp As Excel.Application
  2.         Dim xlBook As Excel.Workbook
  3.         Dim xlSheet As Excel.Worksheet
  4.         Dim xlcombobox As Excel.OLEObject
  5.         Dim iStartLine As Long
  6.  
  7.         xlApp = New Excel.Application
  8.         xlApp.Visible = True
  9.         xlBook = xlApp.Workbooks.Add
  10.         xlSheet = xlBook.ActiveSheet
  11.  
  12.  
  13.         xlcombobox = xlSheet.OLEObjects.Add(ClassType:="Forms.combobox.1", _
  14.          Link:=False, DisplayAsIcon:=False, Left:=1, Top:=25, Width:=72, Height:=24)
  15.         xlcombobox.Name = "clientes"
  16.  
I donít know how to continue help me please
Jun 18 '12 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.