Reflections WRQ help needed

Robertson1995

Board Regular
Joined
Apr 1, 2009
Messages
117
I am using an interface program called Reflections WRQ and need help. Basically I am entering a command called RunTest which displays about 200 rows of data. The command runs fine, but I only need the first 5 rows of data. Is there a way to stop the macro after the 5th row is displayed instead of displaying all of the rows. For example, my 5th row will always be "number of users=1". Is there a way to make the macro stop when it sees this text? Thanks in advance for any help


Sub Test()

On Error GoTo ErrorHandler

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

LF = Chr(Reflection2.ControlCodes.rcLF)
CR = Chr(Reflection2.ControlCodes.rcCR)

With Session
.Transmit "RunTest" & CR
' .WaitForString LF & "/home/test> ", NEVER_TIME_OUT, rcAllowKeystrokes
End With
Exit Sub

ErrorHandler:
Session.MsgBox Err.Description, vbExclamation + vbOKOnly


End Sub
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Yur macro here is an excel macro and just sends a command to Reflection2. I am assuming Reflection2 then does the rest and puts the 200 rows in Excel. There is nothing in this macro that can stop that. However, you could add a few lines to delete all the superfluous lines (after Reflection2 has done its bit) so you don't need to do it by hand. But unless you have access to the RunTest macro within Reflection, it will run its full course of 200 lines first.
 
Upvote 0

Forum statistics

Threads
1,215,022
Messages
6,122,726
Members
449,093
Latest member
Mnur

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top