E8.1 Add Text in Header Attachment through VBA

Aandrey

Member
Hi all,

I am automating order creation in JDE.

The system is very old. I am not sure which version the company has, I think that is 8.1.

The automation process is done within Excel VBA. The VBA code interacts with Internet Explorer web page where JDE is opened, gets HTML controls, searches for the requierd input boxes / buttons / etc. Most of the coding is already done. Sometimes it gets buggy but that's better than nothing.

The problem I'm having now is how to enter text to the Header Attachments - The DOM Explorer does not recognize this element.

If I get this right, that is an ActiveX element (Media Objects). Please see a screenshot attached.

Is there a way to 'capture' this control and paste text? Or some other way to do it programmatically?

As a solution, I've read about converting it to HTML:
But I also need to Characterize text on the next step. If I get that right, converting to HTML won't work in that case.


I'm quite new to JDE - apologies if my questions or statements are not clear.
I didn't get a competent technical answer in my organization, didn't find answers on the web. Even found this site quite recently.
Any help is much appreciated.

Regards,
Andrey
 

Attachments

  • Header attachment Text.png
    Header attachment Text.png
    34.8 KB · Views: 6

Larry_Jones

Legendary Poster
You're very old JDE version (Either 7.33x or 8.9 is your version - there was no 8.1) won't support converting to HTML.
You're stuck with RTF and ActiveX/IE
Current versions do support HTML and have deprecated IE/ActiveX ...
Basically you're using 20 year old software dude.
 

Alex_Pastuhov

Legendary Poster
Hi all,

I am automating order creation in JDE.

The system is very old. I am not sure which version the company has, I think that is 8.1.

The automation process is done within Excel VBA. The VBA code interacts with Internet Explorer web page where JDE is opened, gets HTML controls, searches for the requierd input boxes / buttons / etc. Most of the coding is already done. Sometimes it gets buggy but that's better than nothing.

The problem I'm having now is how to enter text to the Header Attachments - The DOM Explorer does not recognize this element.

If I get this right, that is an ActiveX element (Media Objects). Please see a screenshot attached.

Is there a way to 'capture' this control and paste text? Or some other way to do it programmatically?

As a solution, I've read about converting it to HTML:
But I also need to Characterize text on the next step. If I get that right, converting to HTML won't work in that case.


I'm quite new to JDE - apologies if my questions or statements are not clear.
I didn't get a competent technical answer in my organization, didn't find answers on the web. Even found this site quite recently.
Any help is much appreciated.

Regards,
Andrey
If you are actually on E811/E812, converting to HTML would be a good thing. But if you meant B7334 (which I think was actually called "8" or "8.1" at some point, with JDE name changes you can't even remember all such twists), then as Larry mentioned, you will very probably have to stick with RTF. And then your automation approach will not work head-on, because the DOM element you are looking for is in fact an ActiveX control.
 

Aandrey

Member
Thank you Alex and Larry!
You're very old JDE version (Either 7.33x or 8.9 is your version - there was no 8.1) won't support converting to HTML.
You're stuck with RTF and ActiveX/IE
Current versions do support HTML and have deprecated IE/ActiveX ...
Basically you're using 20 year old software dude.
If you are actually on E811/E812, converting to HTML would be a good thing. But if you meant B7334 (which I think was actually called "8" or "8.1" at some point, with JDE name changes you can't even remember all such twists), then as Larry mentioned, you will very probably have to stick with RTF. And then your automation approach will not work head-on, because the DOM element you are looking for is in fact an ActiveX control.


Yes, indeed, the system is veeery old. They plan to update it but we have now what we have.

I've been struggling with it for weeks and found a solution!
It is a tricky one but it works. It involves Microsoft Inspect utility, UIAutomation and keyboard event from Windows API (also added in VBA):
Code:
Declare PtrSafe Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

1. Using the Inspect tool, I've found the identifier of the the ActiveX control - its class name of "RichEdit20W"
2. Get an Internet Explorer hwnd - that is how UI Automation will interact with it in VBA
3. Using UI Automation API find this element on the IE page
4. Bring focus back to IE
5. Send some dummy character to the found ActiveX form using keyboard event API (and not the SendKeys) - that will ensure JavaScripts are fired
6. Paste text to the ActiveX form using UI Automation "SetValue"
7. "Disconnet" all UI Automation objects in VBA - set them to nothing

Now it works!
 
Top