Jump to content

combobox input fromexcel


Recommended Posts

#include <Excel.au3>

Dim $sPath = @ScriptDir & '\Test1.xls'
Dim $oExcel = _ExcelBookOpen($sPath, 0)
Dim $aArray = _ExcelReadSheetToArray($oExcel)
_ExcelBookClose($oExcel, 0)
Dim $sStr = ''

For $i = 1 To $aArray[0][0]
    For $j = 1 To $aArray[0][1]
        If $aArray[$i][$j] <> "" Then $sStr &= $aArray[$i][$j] & '|'
    Next
Next

$sStr = StringTrimRight($sStr, 1)

GUICreate('Title', 170, 23)
GUICtrlCreateCombo('', 0, 0, 170, 23)
GUICtrlSetData(-1, $sStr)
GUISetState()

Do
    Sleep(20)
Until GUIGetMsg() = -3
Exit

Link to comment
Share on other sites

#include <Excel.au3>

Dim $sPath = @ScriptDir & '\Test1.xls'
Dim $oExcel = _ExcelBookOpen($sPath, 0)
Dim $aArray = _ExcelReadSheetToArray($oExcel)
_ExcelBookClose($oExcel, 0)
Dim $sStr = ''

For $i = 1 To $aArray[0][0]
    For $j = 1 To $aArray[0][1]
        If $aArray[$i][$j] <> "" Then $sStr &= $aArray[$i][$j] & '|'
    Next
Next

$sStr = StringTrimRight($sStr, 1)

GUICreate('Title', 170, 23)
GUICtrlCreateCombo('', 0, 0, 170, 23)
GUICtrlSetData(-1, $sStr)
GUISetState()
[color="#FF0000"][u]$aaa = GUIGetMsg()
MsgBox(0, "a", $aaa)[/u][/color]
Do
    Sleep(20)
Until GUIGetMsg() = -3
Exit
I just added above - why do I get $aaa = -11? Edited by joeloyzaga
Link to comment
Share on other sites

Include the library:

#include <GuiConstantsEx.au3>

-11 is posted because of $GUI_EVENT_MOUSEMOVE event. If you don't feel confident with AutoIt yet it'd be a good start to start with a few tutorials like AutoIt-1-2-3 or the examples in the AutoIt installation directory.

This puts all colums within all rows - what about All Rows, Col1 only?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...