Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA MoveTo Help

Status
Not open for further replies.

kashford

Technical User
Jan 12, 2006
8
US
I am trying to port this sub routine over to Excel VBA from Extra basic

Sub Move(ByVal value$, ByVal field$, ByVal enter As Boolean)

Dim x As Integer, y As Integer

x = Left(field, InStr(field, ",") - 1)
y = Mid(field, InStr(field, ",") + 1, (Len(field) - InStr(field, ",") + 1))

mySess.Screen.MoveTo x, y
System.ActiveSession.Screen.SendKeys (value$)

If enter Then
System.ActiveSession.Screen.SendKeys ("<Enter>")
End If

Do

'Wait Until The Attachmate Screen Has Updated
Loop Until System.ActiveSession.Screen.Updated = True
System.ActiveSession.Screen.WaitHostQuiet (150)

End Sub

I keep getting the error: Object variable or With block variable not set.

What am I doing wrong?
 
Hi,

You have not set objects for the Extra objects.
Code:
    Set oSystem = CreateObject("Extra.System")
    
    Set oSess = oSystem.Sessions.Open("C:\Program Files\E!PC\Sessions\Mainframe.edp")

    With oSess
        .Visible = True
        .WindowState = xNORMAL
    End With

    Set oScrn = oSess.SCREEN
'....


Skip,
[sup][glasses]Don't let the Diatribe...
talk you to death![tongue][/sup][sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
I have a public sub routine that is called on startup that sets them as follows:

Set System = CreateObject("EXTRA.System")
Set Sessions = System.Sessions
Set mySess = System.ActiveSession
Set MyScreen = mySess.Screen

I have tried the code as System.ActiveSession.Screen.MoveTo as well, but I get the same results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top