Page 1 of 1

Help:corrupted text after GetText (VBA)

PostPosted: Thu Sep 12, 2013 6:04 pm
by st213497
Dears,
I am trying to screen scrape the text from the mainframe to excel using excel VBA. The code gets the data but when i insert in cells, the data is corrupted because the screen text language is Arabic.
I tried to copy the screen of the main frame manually using Edit -> select All then Edit -> copy and paste in excel and it worked correctly. I need to send the (select all) and (copy) commands from excel VBA.

My Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim autECLPSObj As Object
   
    Set autECLPSObj = CreateObject("PCOMM.autECLPS")
    autECLPSObj.SetConnectionByName ("A")
   
    Dim feedback As String
    feedback = ""
    feedback = RTrim(autECLPSObj.GetText(1, 1, 220))
    MsgBox feedback
End Sub

Re: Help:corrupted text after GetText (VBA)

PostPosted: Thu Sep 12, 2013 7:47 pm
by dick scherrer
Hello and welcome to the forum,

You would probably get some responses if you posted in a forum that handles VBA.

A few of our members use VBA, but we do not have a part of the forum for this.

Re: Help:corrupted text after GetText (VBA)

PostPosted: Thu Sep 12, 2013 7:59 pm
by st213497
Thank you for your prompt reply.

I wish those who work on VBA to help me.

Re: Help:corrupted text after GetText (VBA)

PostPosted: Thu Sep 12, 2013 8:22 pm
by NicC
You will probably get better help from an Excel forum. It is probably something within VBA but I am just starting out on this VBA road and have neither arabic green screen or arabic excel! as I expect would be the case with most mainframers here.

Re: Help:corrupted text after GetText (VBA)

PostPosted: Fri Sep 13, 2013 12:40 am
by Ed Goodman
Lost my reply for waiting too long to click submit...

Are you saying that when you use the windows cut/paste, it translates Arabic to something else? Or are you just saying that the Arabic copies correctly as Arabic when you do that?

Is the Arabic code page a double-byte character set?

Re: Help:corrupted text after GetText (VBA)

PostPosted: Fri Sep 13, 2013 1:29 am
by Ed Goodman
I found this:
http://publib.boulder.ibm.com/infocente ... ming08.htm

It's what i use when playing with HLLAPI.

Function 34 (Copy field to string) has this note:
The Copy Field to String function translates the characters in the host source presentation space into American National Standard Code for Information Interchange (ASCII). Attribute bytes and other characters not represented in ASCII normally are translated into blanks.

Another note reads:
The string containing the Unicode characters to be sent to the PCOMM session should be typecast to WCHAR * for code page 1390/1399 and to char * for code page 1137.