|
Answer» Greetings all. I currently use a 3270 terminal emulator made by NetManage to connect to our mainframe. It comes with a VBA SCRIPT editor that can automate tasks with VBA. As long as I have the 3270 emulator open and connected, the VBA editor can control the screen. I noticed there is a reference in MS Access for "NetManage WinHLL Automation Server". After some googling, what I GATHER is that the underlying dll, 'NMWhll.dll' is there for the purpose of host automation via any supporting COM container, such as MS Access' VBA editor, and I am gathering this library is how the NetManage VBA editor connects to the host. I can peruse the object PROPERTIES of NMWhll, but I can't figure out how to connect to the host. I'm thinking that from MS Access, I could use the automation object to do things like 'sendkey', 'readscreen', etc that are possible from within the VBA editor provided by NetManage. I realize this is grabbing at straws, but I was wondering if anyone out there knows anything about emulation via MS Access VBA. Thank you.
GregOk, I got the VBA editor to write to my terminal screen. I found that if I have the 3270 emulator open and am connected, I can write to the screen like this... Code: [Select]Sub Test()
Dim host As New NMWhll.NMWhll host.SendKey ("1941") host.SendKey ("ENTER") End Sub
With the above code, the value "1941" (an account number) is being written to the current cursor position on a search screen. I don't have to SET the cursor position, because it opens to the field I need. I then need to hit the enter key. No matter what I try, the value within the parentheses is written to the screen. I was looking at the MSDN doc for the .NET SendKeys method, and it seems like {ENTER} could be passed to perform the same action as hitting the enter key. Now, I realize a .NET method will not work for anything other than .NET, but I would imagine the NetManage dll has a similar method, I just can't find it.Sorry, I am not sure. Have you read this? http://www.contextures.com/excelvbasendkeys.html The examples given show an alias for ENTER. "ENTER" will give your ENTER {ENTER} will give the code or the Enter key of the number pad ~ will give code of the Enter key of the keyboard.
Does that help?
Geek, thanks for the reply. I did not see that one specifically, but I did see much documentation on the 'SendKeys' method, whereas the dll that is exposed in Access (NMWhll) has the 'SendKey'(no s) method, so SendKeys does not work. However, I did manage to find an old reference document for some software called "Blue Zone Script Host and Debugger". It seems to employ the same dll, and it has a section listing the special keys. Indeed, for the enter key I need to use "@E", so host.SendKey("@E") works as described. So I think I am good. The thing now is that our VBA editor that shipped with the emulator (and also uses the same dll) has CUSTOM functionality that I need to reproduce in Access. For example, the dll has a method to return the literal cursor position, rather than return the row and column, as our VBA Editor function does, it returns an integer that is the number of rows * 80 + the column position. Except where the row is one, then the value it returns is simply the column position. Anyhow, writing functions to do that stuff is the fun part, so I think I am good. Thank you.
GregGlad you got it.
|