Attachmate Extra Extreme Find and Replace Macro

Eaglboy1

New Member
Joined
Apr 19, 2016
Messages
20
Hey guys. I'm not sure if anyone here can help with Attachmate macros, but I'm working on writing a macro that will find and replace specific data. I've got the find portion of the macro written, but can't remember how to write the replace funtion. Here's what I have to help me find the information I'm looking for. At the moment, it just gives me a message box of "found it" when it locates the information, but I'm wanting it to automatically replace that information with a specific string of numbers. ie 111111111 instead of 123456789.

Thanks!

Code:
rc% = ConnectSession(SessID)

Do While Eof (1) <> -1
Input #1, CPN$
CPN$ = Trim(CPN$)

CheckScreen:
Rc% = GetString (1,11,Test$,5)
If Test$ = "PAGE2" then
    Goto COUPON: 
ElseIf Test$ = "PAGE2"then 
    Goto COUPON:
Else    
    msgbox "Must Run from PAGE2"
    rc% = ResetSystem()
    Exit Sub    
End If

Dim stringFind As String
Dim userInput As String
        
If Rc% = GetString(15, 068, 2) <> "01" Then
    MsgBox "Please start from Page 1 "
    GoTo theend
End If
            
While stringFind <> CPN$
    stringFind = Sess0.Screen.Search(CPN$)
    
    If stringFind = CPN$ Then
        GoTo done:
    Else
        Rc% = SendHostKeys("@8")
        Rc% = WaitForNoX
        Rc% = WaitHostQuiet(100)
    End If
        
    If Rc% = GetString(24, 002, 38) = "MESSAGE: NO MORE INFORMATION TO SHOW" Then
        GoTo NotFound
    End If
                    
   
NotFound:
    Rc% = SendHostKeys("@1")
    Rc% = WaitForNoX
    Rc% = WaitHostQuiet(100)
    Rc% = SendHostKeys("@E")
    
Loop

done:
    MsgBox ("Found It!")
    Exit Sub
    
Loop
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Forum statistics

Threads
1,214,827
Messages
6,121,818
Members
449,049
Latest member
cybersurfer5000

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