View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
K Dales[_2_] K Dales[_2_] is offline
external usenet poster
 
Posts: 1,163
Default Wrong data format?

It can probably be done - can't really show code since it is too dependent on
your system. However, here is what you could do:

Create either a Worksheet_Change() event procedure or a CommandButton with a
_Click() event procedure that has code to do the following:
a) read the cell value you need to convert
b) apply the conversion routine (dependent on the coding scheme of the
system you are pasting to. You may need to write a VBA function that reads
each character and applies the code translations).
c) Use the AppActivate statement to activate your destination system app;
e.g. AppActivate "Mainframe"
(this assumes it is already open, otherwise Shell command can open it).
d) Use SendKeys statement to send any key combination needed to move the
cursor to the input field where the data is to be entered; e.g. SendKeys
"%E{TAB}{TAB}" (this send alt-E, and two tabs, as if to activate Edit
function then tab two fields - just an example)
e) Use SendKeys now to actually type in the data, e.g. SendKeys
ConvertedText (where ConvertedText would be the variable containing the
converted input text).

Excel VBA Help will give details on the AppActivate and SendKeys statements.
Warning: Timing the AppActivate and SendKeys statements can be problematic
at times, especially if other apps take control of Windows while you are
doing this. I have done similar things and most times it works fine - but if
user gets an incoming email notification at the wrong time strange things can
happen (since the SendKeys will work on the active app - in this case the
email notification instead of the destination app!) So this is possible but
needs to be tested and used with discretion... (OK, disclaimer done.)

Hope this gives you enough to go by to get started...
K Dales

"Peter Ostermann" wrote:

Hi, folks,

trying to transfer data by copy and paste from Excel to an
input-field in the other window that contains a "mask" of a
mainframe dialogue (probably IMS/DC or CICS) makes the screen frozen.
Typing same letters into that mask is possible without any problems.

Can the "copy and paste" be done by an VBA-program? And translated
data same time "on the fly" form ASCII ? (Excel) to (probably) EBCDIC
(mainframe)
data format?

If VBA couldn't do that, is it possible to solve the problem by using
"scripting host" programming? If anyone is out there has some experiences
in this matter that would be great! Thanks for any hint. Best would be the
code
of a sample solution. :-)

Greetings
Peter




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.744 / Virus Database: 496 - Release Date: 24.08.2004