PDA

View Full Version : Copy data from excel to another application



shahcu
09-13-2007, 05:11 AM
Hi,

I am looking for a macro that captures the keystrokes. To be more precise I have to create an application which copy data from excel and paste it into another Mainframe application. Similarly once the one cell data is pasted it again goes back to excel copy another cell data and paste it in Mainframe application at a different cell location and so on so forth. The macro should be intelligent enough to check and copy the value of each cell and paste it into application accordingly under correct heading.

Please help

Regards,
Shane

Oorang
09-13-2007, 07:12 AM
Hi Shane,
This is very doable, but the method really depends on which mainframe emulator you are using. Many actually have referencable libraries that allow you take full control of the emulator from your macro. As far capturing key strokes you can get that data with the WorkSheet_Change event.

Example:
Option Explicit

Const m_strMySpecialAddress_c As String = "$A$5"
Private m_rngCheck As Excel.Range

Private Sub Worksheet_Change(ByVal Target As Range)
If m_rngCheck Is Nothing Then
Set m_rngCheck = Me.Range(m_strMySpecialAddress_c)
End If
Set Target = Excel.Intersect(m_rngCheck, Target)
If Not Target Is Nothing Then
VBA.Beep
'Send info to mainframe
End If
End Sub


Post back with your emulator type and version and I might be able to help you whip something up.