Run a macro on another open application

Closed
Shankar - Mar 5, 2011 at 03:27 PM
rizvisa1
Posts
4479
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
- Mar 6, 2011 at 08:23 AM
Hello,

I have a list of account numbers which needs to be keyed on another application named CBS - "Core Banking System.WS - [24 x 80]"

I had recorded a macro in CBS and customized/mapped to a specific key (page down).
Now I need to run the excel macro which should copy the account number and then switch to the CBS and run the macro recorded in CBS by sendkeys.

I tried using the shell function, but it is not working. Can anyone help me on this?

Sub Macro1()
'
'
Dim z As String
Dim c, e, f As Integer
Dim MWSnap As String
c = 1
111 z1 = InputBox("Enter Number of Accounts in CBS File", "Merge Data")
If z1 = "" Then
GoTo 111
End If
11 If c <= Int(z1) Then
Acccell = "$A$" + Trim(Str(c))
Range(Acccell).Select
Selection.Copy

MWSnap = Shell("C:\Program Files\CBS Macro\CBS.WS", 4)
AppActivate MWSnap
Application.SendKeys ("{PGDN}")

AppActivate "CBS DATA.xls"
z = "$A$" + Trim(Str(c))
Range(z).Select
c = c + 1
GoTo 11
End If
End Sub




1 reply

rizvisa1
Posts
4479
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
769
Mar 6, 2011 at 08:23 AM
You have not mentioned what this other application is based on. Taking worse case scenario in consideration, I am not too sure if you would be able to do so. One option that you can do is that in excel get the account numbers and send it to a file. then you start the other application and have it read that file to get the account number.
0