What's wrong with the VBA codes? RRS feed

  • Question

  • To preface, my VBA knowledge is pretty weak, and the coding is an existing one that I'm trying to figure out. The scenario is below...

    The macro is supposed to pull branch information, which is the second field on the IBM terminal screen, but it is currently not working. The branch and the account fields have been switched in the spreadsheet (first two fields on the terminal screen). Also if it did get the account on screen then it is moving the branch over the account. 

    I don't have the full code below, but the problem codes are bolded. If you want to see the full code, I can provide that on another post.

            .WaitForEvent rcEnterPos, "30", "0", 23, 59
            .WaitForDisplayString ":", "30", 23, 57
            .TransmitANSI "n"

            .TransmitANSI ws.Cells(number, 3).Value
            .TransmitTerminalKey rcIBMEnterKey
            '' wait for the screen to return
              .WaitForEvent rcEnterPos, "30", "0", 23, 59
            .WaitForDisplayString ":", "30", 23, 57
            '' go get the branch – below goes to screen position 1, 24 and pics up 3 characters
            '' and move it to column 2
             memotext = .GetDisplayText(1, 24, 3)
             ws.Cells(number, 2).Value = memotext

    I'm also trying to capture home phone from the screen and add it to column 4. If anyone can at least tell me why the codes are incorrect, and/or how they should really look, that would be a great help. I hope to post a screenshot soon for reference. Thanks in advance. :)

    • Edited by TheJacques Tuesday, January 29, 2013 1:59 AM
    Tuesday, January 29, 2013 1:58 AM