Help with Loop VBA

Madmalky1976

New Member
Joined
Sep 3, 2014
Messages
14
i have the following code[
Sub MAINFRAME()
Dim Sessions As Object
Dim System As Object
Set System = CreateObject("EXTRA.System") ' Gets the system object
If (System Is Nothing) Then
MsgBox "Could not create the EXTRA System object. Stopping macro playback."
Stop
End If
Set Sessions = System.Sessions
If (Sessions Is Nothing) Then
MsgBox "Could not create the Sessions collection object. Stopping macro playback."
Stop
End If
' Set the default wait timeout value
g_HostSettleTime = 10 ' milliseconds
OldSystemTimeout& = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If
' Get the necessary Session Object
Dim Sess0 As Object
Set Sess0 = System.ActiveSession
If (Sess0 Is Nothing) Then
MsgBox "Could not create the Session object. Stopping macro playback."
Stop
End If
If Not Sess0.Visible Then Sess0.Visible = True
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)

' This section of code contains the recorded events
System.TimeoutValue = OldSystemTimeout
'Extra Object
Dim Sys_Obj As Object, Sess_Obj As Object, SPOKScreen_Obj As Object
Set SPOKScreen_Obj = Sess0.Screen
'Excel Object
Dim Excel_Obj As Object, Excel_Sheet As Object
Set Excel_Obj = GetObject(, "excel.application")
Set Excel_Sheet = Excel_Obj.Workbooks("Macro For Mainframe.xlsm").Worksheets(1)
Dim Extra_Col As Integer
Dim Extra_Row As Integer
Dim Extra_Page As Integer
Dim Excel_Row As Integer
Dim Excel_Col As Integer
Dim result As String
Let AGREEMENT = ActiveCell
SPOKScreen_Obj.SendKeys ("")
SPOKScreen_Obj.SendKeys (AGREEMENT)
SPOKScreen_Obj.MoveTo 3, 38
SPOKScreen_Obj.PutString Excel.ActiveSheet.Range("E1").Value
SPOKScreen_Obj.SendKeys ("")
SPOKScreen_Obj.SendKeys ("<ENTER>")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Let result = SPOKScreen_Obj.getstring(10, 1, 1100)
With Excel_Sheet

Range("G2").Value = result
End With

End Sub

code]

i am trying to get the above code to copy the data in column E, go into Attatchmate, enter the agreement number, press enter and then retrieve the relevant information and paste the results into column G.

i am struggling to get this to loop through clumn C until blank and paste results into the corresponding row. it currently is set up just to do this process once.

any help appreciated.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,216,075
Messages
6,128,667
Members
449,462
Latest member
Chislobog

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