×
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!
  • Students Click Here

*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

How do you Pause 3 seconds?

How do you Pause 3 seconds?

How do you Pause 3 seconds?

(OP)
I'm trying to pause my excel macro in attachmate.  
Excel has no pause feature like attachmate.  I've
tried to use Sessions settletime but excel just slows
down.  I've tried to pause in attachmate sendkeys but
Excel doesn't compile it.  I need to pause at a screen
for 3 seconds.  
I'm using sendkeys that don't funcion in each particular
screen I need to view for 3 seconds before the macro moves
on.  This works, just looking for a better way.
[Code]
Sub clear()
    
    ActiveCell.Offset(0, -2) = 1
    ActiveCell.Offset(1, 0).Activate
    Selection.Copy
    
    Dim Sessions As Object
    Dim System As Object
    Set System = CreateObject("EXTRA.System")
    Dim Sess0 As Object
    Set Sess0 = System.ActiveSession
    Set Field = System.ActiveSession.Screen.Area(4, 18, 4, 26)
    Field.Select
    Field.Delete
    Field.Value = ActiveCell
    
    SendKeys "%{TAB}"
    
    Do While Sess0.Screen.OIA.Xstatus <> 0
    DoEvents
    Loop
    
    SendKeys "{ENTER}"
    Sess0.Screen.SendKeys ("<Enter>")
    Do While Sess0.Screen.OIA.Xstatus <> 0
    DoEvents
    Loop
    Call Check
End Sub

Sub bill()

    ActiveCell.Offset(0, -1) = 1
    ActiveCell.Offset(1, 0).Activate
    Selection.Copy
    
    Dim Sessions As Object
    Dim System As Object
    Set System = CreateObject("EXTRA.System")
    Dim Sess0 As Object
    Set Sess0 = System.ActiveSession
    Set Field = System.ActiveSession.Screen.Area(4, 18, 4, 26)
    Field.Select
    Field.Delete
    Field.Value = ActiveCell
    
    SendKeys "%{TAB}"
    
    Do While Sess0.Screen.OIA.Xstatus <> 0
    DoEvents
    Loop
    
    SendKeys "+{ENTER}"
    Sess0.Screen.SendKeys ("<Enter>")
    Do While Sess0.Screen.OIA.Xstatus <> 0
    DoEvents
    Loop
    Call Check
    
End Sub

Sub Check()
               
        Dim Sessions As Object
        Dim System As Object
        Set System = CreateObject("EXTRA.System")
        Dim Sess0 As Object
        Set Sess0 = System.ActiveSession
        SendKeys "{F11}"                 'opens the screen I need to view
        Do While Sess0.Screen.OIA.Xstatus <> 0
        DoEvents
        Loop
        SendKeys "{F11}"                 'F11 doesn't work in this screen
        SendKeys "{F11}"                 'therefore giving me about 2 to
        SendKeys "{F11}"                 '3 seconds to view. I need to pause 3
        SendKeys "{F11}"
        SendKeys "{F11}"
        SendKeys "{F11}"
        SendKeys "{F11}"
        SendKeys "{F11}"
        SendKeys "{F11}"
        SendKeys "{F11}"
        SendKeys "{F11}"
        SendKeys "{F11}"
        SendKeys "{F11}"
        SendKeys "{F11}"
        SendKeys "{F11}"
        SendKeys "{F11}"
        SendKeys "{F11}"
        SendKeys "{F11}"
        SendKeys "{F11}"
        SendKeys "{F11}"
        SendKeys "{F11}"
        SendKeys "{F11}"
        SendKeys "{F11}"
        SendKeys "{F11}"
        SendKeys "{F11}"
        SendKeys "{F11}"
        SendKeys "{F11}"
        SendKeys "{F11}"
        SendKeys "{F11}"
        SendKeys "{F11}"
                       
        SendKeys "{F3}"
        Do While Sess0.Screen.OIA.Xstatus <> 0
        DoEvents
        Loop
        Call Check2
End Sub

Sub Check2()

        Dim Sessions As Object
        Dim System As Object
        Set System = CreateObject("EXTRA.System")
        Dim Sess0 As Object
        Set Sess0 = System.ActiveSession

        Sess0.Screen.Moveto 8, 4
        Sess0.Screen.SendKeys ("1207")
        Sess0.Screen.Moveto 8, 53
        Sess0.Screen.SendKeys ("rev<ENTER>")                 
        Do While Sess0.Screen.OIA.Xstatus <> 0
        DoEvents
        Loop
        Sess0.Screen.Moveto 10, 2
        Sess0.Screen.SendKeys ("r<ENTER>")        'Opens the screen I need to view.

        SendKeys "{F9}"                           'F9 doesn't work in this screen
        SendKeys "{F9}"                           'therefore giving me about 2 to
        SendKeys "{F9}"                           '3 seconds to view. I need to pause 3
        SendKeys "{F9}"
        SendKeys "{F9}"
        SendKeys "{F9}"
        SendKeys "{F9}"
        SendKeys "{F9}"
        SendKeys "{F9}"
        SendKeys "{F9}"
        SendKeys "{F9}"
        SendKeys "{F9}"
        SendKeys "{F9}"
        SendKeys "{F9}"
        SendKeys "{F9}"
        SendKeys "{F9}"
        SendKeys "{F9}"
        SendKeys "{F9}"
        SendKeys "{F9}"
        SendKeys "{F9}"
        SendKeys "{F9}"
        SendKeys "{F9}"
        SendKeys "{F9}"
        SendKeys "{F9}"
        SendKeys "{F9}"
        SendKeys "{F9}"
        SendKeys "{F9}"
        SendKeys "{F9}"
        SendKeys "{F9}"
        SendKeys "{F9}"
                        
        SendKeys "{F3}"
        Do While Sess0.Screen.OIA.Xstatus <> 0
        DoEvents
        Loop
        Call Reset
        
End Sub
        
Sub Reset()

        Dim Sessions As Object
        Dim System As Object
        Set System = CreateObject("EXTRA.System")
        Dim Sess0 As Object
        Set Sess0 = System.ActiveSession
 
        Sess0.Screen.Moveto 8, 4
        Do While Sess0.Screen.OIA.Xstatus <> 0
        DoEvents
        Loop
        
        Sess0.Screen.SendKeys ("<EraseEOF>")
        
        Sess0.Screen.Moveto 8, 53
        Do While Sess0.Screen.OIA.Xstatus <> 0
        DoEvents
        Loop
        
        Sess0.Screen.SendKeys ("<EraseEOF>")
        Do While Sess0.Screen.OIA.Xstatus <> 0
        DoEvents
        Loop
        
        Sess0.Screen.SendKeys ("<Enter>")
        Do While Sess0.Screen.OIA.Xstatus <> 0
        DoEvents
        Loop
        
        Sess0.Screen.Moveto 4, 22
End Sub
 

RE: How do you Pause 3 seconds?

did you try
pause 3


 

RE: How do you Pause 3 seconds?

(OP)
Yes it didn't work.  It makes Excel pause before it runs the macro.

RE: How do you Pause 3 seconds?

(OP)
Found It
Replaced all the Sendkeys with this
[Code]
        newHour = Hour(Now())
        newMinute = Minute(Now())
        newSecond = Second(Now()) + 3
        waitTime = TimeSerial(newHour, newMinute, newSecond)
        Application.Wait waitTime

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