Hi Sachin,
I have done the above coding. But in my case, I am using Citrix server to access both MS-Access and Rumba emulator. However, in the following code, there is no Rumba server name or ipaddress to connect the Rumba session. And this code is not able to identify the mainframe rumba session or screen as I am opening the session manually throgh Citrix server.
Plesae assist me on the following.
Regards,
Ganesh
ganeshkumars82@gmail.com
Declare Function WD_ConnectPS Lib "C:\Program Files\Rumba-52C\SYSTEM\Ehlapi32.DLL" (ByVal hInstance As Long, ByVal ShortName As String) As Integer
Declare Function WD_SendKey Lib "C:\Program Files\Rumba-52C\SYSTEM\Ehlapi32.DLL" (ByVal hInstance As Long, ByVal KeyData As String) As Integer
Declare Function WD_CopyPSToString Lib "C:\Program Files\Rumba-52C\SYSTEM\Ehlapi32.DLL" (ByVal hInstance As Long, ByVal Position As Integer, ByVal Buffer As String, ByVal length As Integer) As Integer
Declare Function WD_DisconnectPS Lib "C:\Program Files\Rumba-52C\SYSTEM\Ehlapi32.DLL" (ByVal hInstance As Long) As Integer
Declare Function WD_SetCursor Lib "C:\Program Files\Rumba-52C\SYSTEM\Ehlapi32.DLL" (ByVal hInstance As Long, ByVal Position As Integer) As Integer
Sub Rumba()
Dim retval As Integer
Dim screen As String
Dim Nom_S As String
Dim NSub_S As String
'Connects the REXX application program to the presentation space window
retval = WD_ConnectPS(100, "A")
If retval = 1 Then
MsgBox ("This will not run on a users own version of Rumba. Please launch from menu.")
End
End If
screen = String$(Val(7), 0) 'Set value
Do 'What screen
RV = WD_CopyPSToString(100, 16, screen, 7) 'Copy data from screen to dataset
Loop Until RV = 0 'What the above successful?
screen = Trim(screen)
If screen <> "Nom/Sub" Then
MsgBox ("Ensure you are in Nom/Sub Function and Restart")
WD_DisconnectPS (100)
End
End If
Sedol = ActiveCell
Do Until ActiveCell.Value = ""
'Cursor. First value always 100? Second value position in char accross screen
RV = WD_SetCursor(100, 1148)
'Send keystroke until successful
Do
RV = WD_SendKey(100, Sedol)
Loop Until RV = 0
Do 'Enter
RV = WD_SendKey(100, "@E")
Loop Until RV = 0
'Setup Field positions
Nom = 268
NSub = 828
'Retrieve fields values
screen = String$(Val(3), 0)
Do
RV = WD_CopyPSToString(100, Nom, screen, 3)
Loop Until RV = 0
Nom_S = Trim(screen)
Do
RV = WD_CopyPSToString(100, NSub, screen, 3)
Loop Until RV = 0
NSub_S = Trim(screen)
Do 'PF9
RV = WD_SendKey(100, "@9")
Loop Until RV = 0
'Paste field values into Excel
ActiveCell.Offset(0, 1) = Nom_S
ActiveCell.Offset(0, 2) = NSub_S
ActiveCell.Offset(1, 0).Activate
Loop
WD_DisconnectPS (100)
End Sub