Say I have a form (efm) that includes edit box and a button. The button does a bunch of things but first it needs to check to ensure that file specified in edit box is excel file. Here's what I have done but this does not work i.e. get the error shown in snapshot below and DxDesigner crashes. The code you see below is in efm (form) as supposed to a vbs file. It looks like I cannot use For iOuterloop = 1 to 1 in efm (it works fine in a vbs). How to work around this? Ideas are appreciated.
Sub Button1_EventClick()
Dim This : Set This = Button1
For iOuterLoop = 1 To 1
sEditBoxText = EditBox1.Text
' ensure that Edit Box Text is xlsx file
EditTextArray = Split(sEditBoxText, ".")
iLastSubscript = UBound(EditTextArray)
sLastArrayValue = EditTextArray(iLastSubscript)
sLastArrayValue = LCase(sLastArrayValue)
If sLastArrayValue <> "xlsx" Then
MsgBox "This is not an Excel file"
Exit Sub
Else
'all code goes here
End If
Next
Just to add that where you see Exit Sub, I initially had Exit For and was running into same problem.