Our vBulletin migration is complete.
Welcome vBulletin users! All content and user information from the Micro Focus Forums (vBulletin) site has been migrated to this site. READ MORE.
marshallgrads Absent Member.
Absent Member.
1093 views

Split test example

Here is an example of how to take a string and split it into pieces..

Sub SPLITTEST_EXAMPLE()
' HERE IS AN EXAMPLE OF HOW TO PROVIDE A LIST AND THEN SPLIT THAT LIST AND USE IT WITH A FOR-NEXT LOOP
' BUTCH JONES 5/15/2017
' CODED IN MICRO FOCUS REFLECTION - DESKTOP Pro EDITION, VERSION 16.0 SP-1

Dim osCurrentScreen As Screen
Dim osCurrentTerminal As Terminal
Dim returnValue As Integer

Const NEVER_TIME_OUT = 0

Dim LF As String ' Chr(rcLF) = Chr(10) = Control-J
Dim CR As String ' Chr(rcCR) = Chr(13) = Control-M

Set osCurrentTerminal = ThisFrame.SelectedView.control
Set osCurrentScreen = osCurrentTerminal.Screen

LF = Chr(10)
CR = Chr(13)

'<=====================================================

Dim LISTS As String

LISTS = "COAG,XE-5000,XT-4000i,URINALYSIS/URINE MICRO,MISC URINALYSIS TESTS,DIFFS/S+4," & _
"MISC HEMATOLOGY TESTS,5600 BOTH,GENEXPERT,NOVA,SED RATES (CDD-WK),SPECIAL HEMATOLOGY," & _
"POLYMEDCO,TOSOH8,VIDAS,"

SPLITTEST = Split(LISTS, ",")
'DATA WILL BE SPLIT AND PARSED ON THE COMMA SEPARATING EACH LOADLIST/INSTRUMENT
'SPLITTEST(0) = COAG
'SPLITTEST(1) = XE-5000
'SPLITTEST(2) = etc.....
'<=====================================================>

With Session

For Each x In SPLITTEST

If x = "" Then
MsgBox "GREAT JOB BUTCH, YOUR DONE"
osCurrentScreen.SendKeys "Clear instrument/worklist"
osCurrentScreen.SendControlKey ControlKeyCode_Return
Else
'=========================
MsgBox "THE LIST YOU SHOULD SEE IS : " & x
'=========================
End If


Next

End With

Exit Sub


End Sub

1 Reply
vfast Absent Member.
Absent Member.

Re: Split test example

Another handy way to display test or debug output using VBA (other than "MsgBox") is to use "Debug.Print". This will send text to the "intermediate" window in the VBA environment, which you can make visible by typing Ctrl+g, or it is also on the View menu.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.