Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Do...Loop statement in VBA

Status
Not open for further replies.

newguy86

Technical User
May 19, 2008
226
US
I am wanting to have a macro that will input information provided by the user into an IBM Reflection Session screen. I want the macro to loop until it gets to the end of the current list and then end the macro so that the user can complete their task. The problem that I am having is that either the macro will loop indefinetly or it gets caught on the .WaitForEvent line, i'm guessing because the .MoveCursor command isn't executing correctly. So if anyone can help with checking on a string value at a specific point in Reflection, it will be greatly appreciated.

With Session
Dim GroupBranch As String
Dim MousePos As String
GroupBranch = ""
GroupBranch = .GetPassword("GPBR # ===>", "", "", "")
MousePos = ""
Do While MousePos <> ""
.MoveCursor 10, 8
.WaitForEvent rcEnterPos, "30", "0", 10, 8
.TransmitANSI GroupBranch
.TransmitTerminalKey rcIBMTabKey
.TransmitANSI GroupBranch
.TransmitTerminalKey rcIBMPageDownKey
If MousePos = "" Then Exit Do
Loop

I know that there are parts missing. I intentionally left them out because I could not get them to work, nor could I figure out which specific setup to go with. So if you could just add what it is that you think would work that would be helpful.

Thanks

Travis
 
Why are you trying to do this in a macro instead of VBA?

"Time flies like an arrow; fruit flies like a banana."
 
Hi newguy,

It looks to me like your loop will never execute. The statements:
Code:
MousePos = ""
Do While MousePos <> ""
are mutually exclusive.


genomon,
Why are you trying to do this in a macro instead of VBA?
Strange question, given that macros ARE vba ...

Cheers

[MS MVP - Word]
 
genomon-

I will have to agree with macropod!

macropod-

I have the macro setup as so because in setting MousePos = "", I wanted the macro to stop running when MousePos returned a value of Null. Since MousePos should be checking its location for a value.

I actually completed the macro a few days ago using a different method so thank you to all who replied and I will try to get the completed macro up in a couple of days as long as work doesn't have a confidentiality issue.

Travis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top