VBA - Updating different system through excel

shrestra

New Member
Joined
Apr 1, 2013
Messages
3
Hi,
I have been using following VB script in excel to run my macros for a while to update system in AS400. This was working perfectly until I got a new computer.
Basically this scripts copies data from row 1 column 1 and pastes into AS400 screen and continues to row 1 column 2. Afer that it moves to row 2 untill everything in the spreadsheet is complete.

Now, whever I run this script, it will take me to AS400 screen but won't paste anything. Could someone help?


Sub macro1()
Dim yRow
Dim xCol
Dim WindowName
On Error Resume Next
WindowName = Worksheets("Sheet1").Cells(1, 9).Value
Windows(1).WindowState = xlMinimized
AppActivate WindowName, Wait
If Err.Number <> 0 Then
MsgBox Err.Description
Err.Clear
Exit Sub
End If
col = 1
Row = 1
AppActivate WindowName

While Trim(Worksheets("Sheet1").Cells(Row, 1).Value) <> ""
SendKeys CStr(Worksheets("Sheet1").Cells(Row, 1).Value) + "{Enter}" + "{Tab}" + "{Tab}" + "{Tab}"
SendKeys CStr(Worksheets("Sheet1").Cells(Row, 2).Value) + "{Tab}" + "{Tab}" + "{Tab}" + "{Enter}"
Row = Row + 1
Wend
End Sub
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,196,329
Messages
6,014,680
Members
441,835
Latest member
rthomas268

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top