I have the below code running in excel vba. What I want to do is run this into a access table. I'm not to familiar w/access vba. Basically how this is setup now is my excel sheet has it's required header rows already put in and then I run this macro to get data from Extra Mainframe to put in the selected rows/cols. Other than knowing I'll need to change Dim ws As Worksheet & Set ws = ActiveWorkbook.Sheets("Sheet1") I'm not sure what all I need to change to get it to run in an Access table. Anyone able to help. Thanks
Code:
Sub queues()
Application.ScreenUpdating = False
Dim Sessions, System As Object, Sess0 As Object
Set System = CreateObject("EXTRA.System")
Set Sessions = System.Sessions
Set Sess0 = System.ActiveSession
Dim ws As Worksheet
Set ws = ActiveWorkbook.Sheets("Sheet1")
done = Sess0.Screen.GetString(24, 2, 3)
queue = Sess0.Screen.GetString(2, 10, 11)
If done <> "END" And queue <> "F0009 / 11" Then
x = 1
r = 1
Do
Sess0.Screen.MoveTo 6, 67
Sess0.Screen.SendKeys ("f000")
Sess0.Screen.SendKeys (x)
Sess0.Screen.MoveTo 7, 67
Sess0.Screen.SendKeys ("001")
Sess0.Screen.SendKeys ("<enter>")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Do
r = r + 1
acct_num = Sess0.Screen.GetString(3, 19, 10)
ws.Cells(r, 1) = acct_num
hold_date = Sess0.Screen.GetString(21, 26, 8)
ws.Cells(r, 2) = hold_date
hold_reason = Sess0.Screen.GetString(21, 44, 1)
ws.Cells(r, 3) = hold_reason
done2 = Sess0.Screen.GetString(24, 2, 3)
Sess0.Screen.SendKeys ("<pf8>")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Loop Until done2 = "END"
Sess0.Screen.SendKeys ("<pf3>")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
x = x + 1
Loop Until x = 9
End If
End Sub