justice8965
Registered User.
- Local time
- Today, 08:39
- Joined
- Aug 25, 2009
- Messages
- 32
Hey all,
So I have a program where the user selects some spreadsheets with information they want to import. They can select as many as they like, these are then added to a ListBox. The user than clicks the Import button to do some calculations and the actual import.
This works fine when they select 5 files, or less. However, if they try to select any more than 5, something goes wrong, and I'm not sure what. Here is my code.
lngFlags = ahtOFN_ALLOWMULTISELECT Or ahtOFN_EXPLORER
Dim result As Variant
result = ahtCommonFileOpenSave(InitialDir:="C:\", _
Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
DialogTitle:="Hello! Open Me!")
If lngFlags And ahtOFN_ALLOWMULTISELECT Then
If IsArray(result) Then
Dim i As Integer
For i = 0 To UBound(result)
'MsgBox result(i)
Forms!ElectricImport!filesListBox.RowSourceType = "Value List"
Forms!ElectricImport!filesListBox.RowSource = AddItem(Forms!ElectricImport!filesListBox.RowSource, result(i), 0)
Next i
Else
'MsgBox result
Forms!ElectricImport!filesListBox.RowSourceType = "Value List"
Forms!ElectricImport!filesListBox.RowSource = AddItem(Forms!ElectricImport!filesListBox.RowSource, result, 0)
End If
Else
MsgBox result
End If
The part that is bold and underlined is where the code checks to see if multiple files have been selected, by checking to see if the variable is an array or not. If they select more than 5 files, this is where the program skips. Why does it create an array for 5 or under, but not over?
Any help would be greatly appreciated.
So I have a program where the user selects some spreadsheets with information they want to import. They can select as many as they like, these are then added to a ListBox. The user than clicks the Import button to do some calculations and the actual import.
This works fine when they select 5 files, or less. However, if they try to select any more than 5, something goes wrong, and I'm not sure what. Here is my code.
lngFlags = ahtOFN_ALLOWMULTISELECT Or ahtOFN_EXPLORER
Dim result As Variant
result = ahtCommonFileOpenSave(InitialDir:="C:\", _
Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
DialogTitle:="Hello! Open Me!")
If lngFlags And ahtOFN_ALLOWMULTISELECT Then
If IsArray(result) Then
Dim i As Integer
For i = 0 To UBound(result)
'MsgBox result(i)
Forms!ElectricImport!filesListBox.RowSourceType = "Value List"
Forms!ElectricImport!filesListBox.RowSource = AddItem(Forms!ElectricImport!filesListBox.RowSource, result(i), 0)
Next i
Else
'MsgBox result
Forms!ElectricImport!filesListBox.RowSourceType = "Value List"
Forms!ElectricImport!filesListBox.RowSource = AddItem(Forms!ElectricImport!filesListBox.RowSource, result, 0)
End If
Else
MsgBox result
End If
The part that is bold and underlined is where the code checks to see if multiple files have been selected, by checking to see if the variable is an array or not. If they select more than 5 files, this is where the program skips. Why does it create an array for 5 or under, but not over?
Any help would be greatly appreciated.