Hi,
I have written some code from Excel to interact with attachmate and select all, copy and paste into excel. This appeared to be working yesterday, however everytime I try to run now I get this runtime error. My code is ...
--------------------------------------------------------
---------------------------------------------------------
Any ideas where I'm going wrong ???
Thanks,
Gary.
I have written some code from Excel to interact with attachmate and select all, copy and paste into excel. This appeared to be working yesterday, however everytime I try to run now I get this runtime error. My code is ...
--------------------------------------------------------
Code:
Sub Capture
Dim warn As Integer ' No = 7 Yes = 6
warn = MsgBox("Are you sure you want to run this report?", vbCritical + vbYesNo + vbDefaultButton2, "Run Report")
If warn = 7 Then
Exit Sub
Else
End If
Sheets("Menu").Select
Dim dname As String
dname = Range("$C$2").Text
Dim Sessions As Object
Dim System As Object
Set System = CreateObject("EXTRA.System")
If (System Is Nothing) Then
MsgBox "error1"
Stop
End If
Set Sessions = System.Sessions
If (Sessions Is Nothing) Then
MsgBox "error2"
Stop
End If
For Sess = 1 To Sessions.Count
If StrComp(Sessions.Item(Sess).Name, dname, vbTextCompare) = 0 Then Exit For
Next Sess
Dim Sess0 As Object
Set Sess0 = System.Sessions.Item(Sess)
If (Sess0 Is Nothing) Then
MsgBox "error3"
Stop
End If
If Not Sess0.Visible Then Sess0.Visible = True
Sheets("DataDump").Select
Range("E1:E9105").Select
Selection.ClearContents
Range("B1").Select
Again:
Dim Cont As String
Cont = Range("$K$1").Text
Dim NextDump As String
NextDump = Range("$K$2").Text
If Cont = "GO" Then
GoTo ScreenScrape
Else
Range("D1").Select
Exit Sub
End If
ScreenScrape:
Sess0.Screen.SelectAll
Sess0.Screen.Copy
Sess0.Screen.SendKeys ("<RollUp>")
Range(NextDump).Select
ActiveSheet.Paste
GoTo Again
End Sub
Any ideas where I'm going wrong ???
Thanks,
Gary.