'————————————————————————————————————————————— ' Name: Function IsKeyLoaded ' Purpose: Checks if array of keys to be input to Calculator is valid ' Input: ' arrKeys ' Output: ' Boolean ' Date: ' Author: ' Remarks: '————————————————————————————————————————————— Private Function IsKeyLoaded( arrKeys ) '————————————————————————————————————————————— Dim arrFixedKeys Dim blnExists Dim inKey, fixKey arrFixedKeys = Array( 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, "/", "CE", "*", "C", "-", "%", &_ "±", ".", "+", "=" ) For Each inKey in arrKeys blnExists = False For Each fixKey in arrFixedKeys If Trim(LCase(CStr(inKey))) = Trim(LCase(CStr(fixKey))) Then blnExists = True Exit For End If Next If Not blnExists Then IsKeyLoaded = blnExists Exit Function End If Next IsKeyLoaded = blnExists End Function '————————————————————————————————————————————— ' Name: Sub SiebCalculatorClickKeys ' Purpose: ' Input: ' oCalculator - object reference to the Calculator hierarchy ' arrKeys - Keys to be pressed on the calculator object ' Output: ' Integer 'Dependancy: IsKeyLoaded ' Date: ' Author: ' Comments: '————————————————————————————————————————————— Public Sub SiebCalculatorClickKeys( ByVal oCalculator, ByVal arrKeys ) '————————————————————————————————————————————— Dim i ' Check if the keys entered by the user are valid and exist as keys on the '_ SiebCalculator object. isValid = IsKeyLoaded(arrKeys) ' The following component can be modified to also work with 'ClickKeys': '_ enter an array with multiple values in each element and use clickKeys if the length '_ is greater than 1, unless if it is the key "CE" If Not isValid Then Reporter.ReportEvent micWarning, "Invalid Key(s)", "Array: " & Join(arrKeys, ",") Else 'object.OpenPopup For i = LBound(arrKeys) to UBound(arrKeys) oCalc.ClickKey arrKeys(i) Next 'object.ClosePopup End If End Sub