您的位置:程序门 -> vb -> vba



vb怎么样给excel中的combobox赋值?


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


vb怎么样给excel中的combobox赋值?
发表于:2007-12-18 21:01:05 楼主
请教:
        有一个vb程序,需要将一些变量的值传个一个excel表中的combobox的list像项中,现在无法实现,请帮帮我。谢谢。
发表于:2007-12-18 21:37:091楼 得分:0
sql   =   "select   组别   from   组别设置     order   by   组别"
rsother.close
rsother.open   sql,   cn
if   rsother.recordcount   >   0   then
      rsother.movefirst
      do   while   not   rsother.eof
            oexcel.activesheet.combobox5.additem   (trim(rsother("组别")))
            rsother.movenext
      loop
end   if
发表于:2007-12-19 19:35:282楼 得分:0
由于我对sql不熟悉,请举实例好嘛?组别,组别设置怎样用???
excel中需要被写入的combobox很多,并且不是控件数组,单条写入怎么办?谢谢您。
发表于:2007-12-19 20:23:483楼 得分:0
excel里创建combobox的时候命名默认是combobox1,combobox2,combobox3...

写入的时候只须这样:

oexcel.activesheet.combobox1.additem   变量  


快速检索

最新资讯
热门点击