Results 1 to 5 of 5

Thread: On error code

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2007
    Posts
    2

    On error code

    Hello all. I am having a problem. I need an on error code for my macro below. The coding below is designed to find IA on screen, once it's found it should go to .FoundTextRow column 3. but if it is not found on the screen then I need it to .TransmitTerminalKey rcIBMreset key and continue. Any suggestions?

    Right now, it errors out on runtime error 4132.


    displayText = Session.FindText("IA", 8, 75)
    .SetMousePos .FoundTextRow, 3
    .TerminalMouse rcLeftClick, rcMouseRow, rcMouseCol
    .TransmitANSI "x"
    .TransmitTerminalKey rcIBMEnterKey
    .WaitForEvent rcKbdEnabled, "30", "0", 1, 1
    .WaitForEvent rcEnterPos, "30", "0", 20, 41
    .WaitForDisplayString "Action:", "30", 20, 33
    .TransmitANSI "accomplete"
    .TransmitTerminalKey rcIBMEnterKey

    Thanks in advance.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: On error code

    Welcome to the Forums.

    Is this in VB 6 or something else? Are you using some control as "Session" is not a native VB 6 object. Are you automating a Terminal Emulation program or ???
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2007
    Posts
    2

    Re: On error code

    Well, it is VB 6.3 and it is for AS400 Reflections.

  4. #4

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: On error code

    What are the return possibilities of displayText ?

    Not sure if it supports Len but its a basic in VBA so it should. It will test the length of the value in the variable - displayText.
    Code:
    displayText = Session.FindText("IA", 8, 75)
    If Len(displayText) = 0 Then
        'Not found 
        .TransmitTerminalKey rcIBMreset 
    Else
        .SetMousePos .FoundTextRow, 3
        .TerminalMouse rcLeftClick, rcMouseRow, rcMouseCol
        .TransmitANSI "x"
        .TransmitTerminalKey rcIBMEnterKey
        .WaitForEvent rcKbdEnabled, "30", "0", 1, 1
        .WaitForEvent rcEnterPos, "30", "0", 20, 41
        .WaitForDisplayString "Action:", "30", 20, 33
        .TransmitANSI "accomplete"
        .TransmitTerminalKey rcIBMEnterKey
    End If
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width