WRQ Reflection/VBA copy read data to Excel

ambertje

New Member
Joined
Aug 17, 2011
Messages
6
Hello everybody,

I'm trying to read out text information out of a reflection session.
The lines are stored in strData and I can see all the textlines in the Locals window.

There is however a problem I can't solve no mather how hard I try.
My programming skills are these from a beginner.

After the textstrings are stored in the variable strData I would like to copy them into an Excel sheet.
If all the textlines are copy-d then I would like to send that sheet with an Email to a group of people. All this by using VBA

Can anybody help me please :confused:

Here's is an example of the code I've already have:

Code:
'Inlezen rapport SPRRA
'Sessie : Reflection Newbase sessie,cursor staat op het in te lezen rapport in het SPRRA scherm
'Resultaat : 1 dimensionele array van de lijnen van het betreffende rapport
Private Function fPick_Rep(Sessie As Reflection4.Session) As Variant
    Dim strData() As String, i As Integer, j As Integer, r As Integer, l As Long, t As Long, s As Long
    ReDim strData(0 To 0)
    With Sessie
        Dim strWacht(1 To 2) As String
        strWacht(1) = VBA.Chr(VBA.Asc(vbLf)) + ":"  'vbLf is een linefeed
        strWacht(2) = VBA.Chr(VBA.Asc(vbLf)) + "(EOF):"
        
        Sessie.DisplayMemoryBlocks = 10 'geheugen wordt hier vergroot
        Sessie.DisplayMemoryBlocks = 9 'hier terug verlaagd
        
        .Transmit "b"
        Do
            j = Sessie.Application.WaitForStrings(strWacht, 5)
            If j = 0 Then
                MsgBox "Er liep iets mis !"
                Exit Function
            Else
                r = .cursorRow 'kijkt waar de cursor staat en stopt dit in var.r
                l = UBound(strData) 'om de bovenkant van de file aan te geven
                s = 0
                ReDim Preserve strData(0 To l + r - VBA.IIf(l = 0, 1, 0) + VBA.Abs(Sessie.DisplayMemoryTopRow))
                t = VBA.IIf(l = 0, 0, 1)
                For i = Sessie.DisplayMemoryTopRow To r - 1
                    strData(l + s + t) = .GetText(i, 0, i, .DisplayColumns)
                    s = s + 1
                Next
            End If
       'Even schermhegeheugen resetten
            Sessie.DisplayMemoryBlocks = 10
            Sessie.DisplayMemoryBlocks = 9
            .Transmit VBA.Chr(13) 'character 13 is een carriage return
            DoEvents
        
        'Als j = 2 dan hebben we het einde bereikt
            If j = 2 Then
                .WaitForString "DETAIL"
                Exit Do
            End If
        Loop
    End With
    fPick_Rep = strData
End Function
Public Sub leesrapport()
    Dim varData As Variant
    varData = fPick_Rep(Me)
End Sub

Ambertje
 
Hi Ruddles,

I wont ignore you ;)
I can appreciate a joke once and a while.
You've helped me in the write direction with the excel problem, I'll try your advice for the word app.

Thanks a lot,
Ambertje
 
Upvote 0

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
am using the WRQ Reflection for IBM 3270 i need to Run a Macro In Reflection to copy data from Excel and paste it into Reflection
i dont know how to do that!!... i have created a example of vba for you to understand a create a vba macro from it
i have data in excel Column A and B
1st I need to Copy data from A1 and paste it into Reflection Position .WaitForEvent rcEnterPos, "30", "0", 3, 11 & after that it will move to next screen and have to copy data from B1 and paste it in position .WaitForEvent rcEnterPos, "30", "0", 4, 11
.WaitForDisplayString "SEALS..:", "30", 4, 2 and enter and this process should continue till the last cell with data ... I can upload a Excel File if required with Screen Shots of WRQ Screens !!
Code:
Sub macro3() 
 
With Session 
 
Dim excelwb As Object 
Dim z As Integer 
Set excelwb = GetObject(, "Excel.Application") 
Set excelwb = GetObject("C:\Documents and Settings\mintezar\Desktop\Book1.xls") 
z = excelwb.Worksheets("Load").Range("A 1").Value 
    Selection.Copy 
        .WaitForEvent rcEnterPos, "30", "0", 3, 11 
        .WaitForDisplayString "NBR:", "30", 3, 6 
        .Paste 
        .TransmitTerminalKey rcIBMEnterKey 
    End With 
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,297
Members
452,903
Latest member
Knuddeluff

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