hi,
i'm trying to list a range (PartNo) from Excel into a DropCombo Box.So far I'm only able to list only one cell in the range.
how do i enumerate the range so that it will appear correctly in the DropCombo Box?
thanks
zach
i'm trying to list a range (PartNo) from Excel into a DropCombo Box.So far I'm only able to list only one cell in the range.
how do i enumerate the range so that it will appear correctly in the DropCombo Box?
thanks
zach
Code:
Declare Function DisplayChoice(szLocale$) As String
Sub Main
Dim szLocation$
Dim iDone%
Dim DroplistBox as string
Dim xlApp As Object, xlWB As Object, xlSheet As Object
Dim xlFile As String, i As Long
xlFile = "C:\Test2.xls"
Set xlApp = CreateObject("Excel.Application")
Set xlWB = xlApp.Workbooks.Open(xlFile)
xlApp.visible = true
Set xlSheet = xlWB.Sheets("sheet1")
For i = 2 to 13
CurrPartNo = xlSheet.Range ("A1")
PartNo = xlSheet.Range ("C" & i) 'this is where i need help
Next
Begin Dialog Proc 0, 1, 175, 93, "Please Select"
ButtonGroup .ButtonPressed
OkButton 100, 55, 50, 14
CancelButton 100, 15, 50, 14
PushButton 100, 35, 50, 14, "&Reset", .btnReset
Text 12, 10, 62, 9, "Available Sessions"
Text 12, 18, 82, 9, "Click on down arrow"
Text 12, 25, 62, 9, "and select"
Text 12, 58, 82, 9, "CurrPartNo is"
Text 12, 68, 82, 9, CurrPartNo
DropComboBox 10, 35,65,55, PartNo, .dcbSessions 'help here as well
End Dialog
iDone = FALSE
While (iDone = FALSE)
Dim dMain as Proc
nRet = Dialog(dMain)
Select Case nRet
Case -1 ' -1 is returned if the user chose OK
iDone = TRUE
szLocation = dMain.dcbSessions
If SzLocation = "" Then
MsgBox "You Didn't Select a Session. Please Start Over"
Exit Sub
End If
Case 0 ' 0 is returned if the user chose Cancel
iDone = TRUE
'msgbox "Please select a Session"
Case 1 ' 1 is returned if the user chose Reset
dMain.dcbSessions = ""
Case Else
msgbox "Some undefined button pressed " + str(dMain.ButtonPressed)
End Select
Wend
xlApp.DisplayAlerts = False
xlWB.Save
xlWB.Close
Set xlSheet = Nothing
Set xlWB = Nothing
Set xlApp = Nothing
End Sub
'--------------------------------------------------------------------------------
Function DisplayChoice(szLocale$) As String
szResult = szLocale
DisplayChoice = szResult