×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

steping through code problems

steping through code problems

steping through code problems

(OP)
i want to step through my code.
I have one sub routine calling another sub routine. i can step through the first sub routine one line at a time.
when the first sub calls the second sub, the second sub just seems to go off and run where as i want to step through it. I also dont understand why in the second sub, "max" i need the first 16 lines of code but if i dont it seems to get stuck in a loop and keeps sending an S.

how can I step through my second sub?
Why do I need so much code in the second sub, is there a better way, what is it?
thank you smiler44



' Global variable declarations
Global g_HostSettleTime%
Global g_szPassword$
declare sub max()

Sub Main()
' Get the main system object
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 = 3000 ' 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)
max
end sub


sub max()

'Get the main system object
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

' Get the necessary Session Object
Dim Sess0 As Object
Set Sess0 = System.ActiveSession

Sess0.Screen.Sendkeys("s")
End Sub

RE: steping through code problems

Hey

Don't why you can't step through your second sub, but if you put your 'Dim' statements outside the sub, the variables will become public for all Subs and Functions to use, so you won't need to define and assign the values a second time.

The assignments need to be inside a Function or Sub, but 'Dim' can be outside.

Lakare

RE: steping through code problems

Hmmm?

all that max does is set attachmate system/session objects.

If you declared these as global, then the only statement in max would need to be...

CODE

Sub max()
    Sess0.Screen.SendKeys ("s")
End Sub 

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: steping through code problems

(OP)
Global.... right I'll try that, thank you SkipVought

smiler44

RE: steping through code problems

(OP)
Lakare, thank you is Set System = CreateObject("EXTRA.System") ' Gets the system object the assingment?

smiler44

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close