Help with VBA Code to PCOMM

daniloleiter
NewLounger
Posts: 4
Joined: 02 Mar 2011, 13:22

Help with VBA Code to PCOMM

Post by daniloleiter »

Hi,

I'm writing a VBA code in excel to retrieve data from Personal Communications. At some point I need to determine if a text in a defined Row and Col is of color white! Can anyone help me? I'm trying to use WaitForAttrib but I can't get it to work.

Sub Teste()
Dim autECLPSObj As Object

Set autECLPSObj = CreateObject("PCOMM.autECLPS")
autECLPSObj.SetConnectionByName ("A")


If autECLPSObj.WaitForAttrib(11, 18, "F", "3c", 3, 1000) Then
MsgBox "Attribute"
Else
MsgBox "Timeout Occurred"
End If

End Sub

Can anyone please help?

User avatar
HansV
Administrator
Posts: 78665
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Help with VBA Code to PCOMM

Post by HansV »

Welcome to Eileen's Lounge!

We don't have many members who work with PCOMM but there are a few, so hopefully you'll get a reply; don't expect it immediately though.
Best wishes,
Hans

daniloleiter
NewLounger
Posts: 4
Joined: 02 Mar 2011, 13:22

Re: Help with VBA Code to PCOMM

Post by daniloleiter »

Yeah, not that many people who know about PCOMM. I really hope one of them respond. Perhaps you could give me a little help with this:
I am having troube defining the hexadecimal values of the function.

Here is the IBM description to what the values should be but the tables talk about bytes. Do you understand this? Thanks
http://publib.boulder.ibm.com/infocente ... cess04.htm" onclick="window.open(this.href);return false;

User avatar
HansV
Administrator
Posts: 78665
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Help with VBA Code to PCOMM

Post by HansV »

Apparently the "ColorPlane" contains information about the text (foreground) and fill (background) colors in a single byte. You can specify hexadecimal values in VBA in the form &Hmn where m and n are the values mentioned in the tables, for example &H13 will be blue text on a red background (or vice versa, I always forget which order Windows uses).

I don't think you need WaitForAttribute here, that would wait for the specified time to see if an attribute appears. But I don't know anything about PCOMM so I can't tell you what you need here. Sorry!
Best wishes,
Hans

User avatar
VegasNath
5StarLounger
Posts: 1185
Joined: 24 Jan 2010, 12:02
Location: Wales, UK.

Re: Help with VBA Code to PCOMM

Post by VegasNath »

daniloleiter wrote:Hi,

I'm writing a VBA code in excel to retrieve data from Personal Communications. At some point I need to determine if a text in a defined Row and Col is of color white! Can anyone help me? I'm trying to use WaitForAttrib but I can't get it to work.
Hi, with the help of others here, I have done quite a bit with PCOMM over the last few years, so will help if I can.... I'm not quite sure what it is that you are trying to get at exactly, could you elaborate a little further? What is the purpose of the white text??
:wales: Nathan :uk:
There's no place like home.....

daniloleiter
NewLounger
Posts: 4
Joined: 02 Mar 2011, 13:22

Re: Help with VBA Code to PCOMM

Post by daniloleiter »

I have a few plants in which parts are bought. These plants are show in a line in the PCOMM. When I press f18 it cycles through the plants and the plant that is active in the moment has it's text white. So I need to determine which of the plants has white text so that I can determine which plant is active. Hope I've made myself clear! Thanks for your help

User avatar
VegasNath
5StarLounger
Posts: 1185
Joined: 24 Jan 2010, 12:02
Location: Wales, UK.

Re: Help with VBA Code to PCOMM

Post by VegasNath »

Ok, then I apologise, I don't think I am going to be of much help as I have never had a need for such code. The application that I use PCOMM with is a black screen with all green text. Have you tried using the macro recorder? This may help to identify the syntax for what you need?

Another thought though, Is f18 the equivalent of 'tab'? Does the cursor move? Could you use the cursor position (screen coordinates) to achieve the same result?
:wales: Nathan :uk:
There's no place like home.....

daniloleiter
NewLounger
Posts: 4
Joined: 02 Mar 2011, 13:22

Re: Help with VBA Code to PCOMM

Post by daniloleiter »

f18 is not a problem as you SendKeys [pf18] works perfectly. This can't be done with the screen position. I have solved my problem using the FieldList and the Intesity parameter.
The macro recorder can't help me because I don't see any way of working with colors while recording. If you can please past me your code. Thanks