I am running a macro from excel that goes into Extra. I tried to use
Do while Sess0.Screen.OIA.Xstatus <> 0
Doevents
Loop
But Extra runs the macro so fast it won't recognize a wait string.
I tried using Do While and Do Unitl loops but then the macro will sometimes skip a step and screw up. Most recently I have started to use If <> variable then goto Start. Clunky and still doesn't catch everything.
For example there is one screen where the macro will not enter a new screen name unless a pause is built in. Without the pause it skips the new screen name and just hits enter which goes to the wrong screen.
In thread 1-1261727 there is discussion on how to run code based off of Do While Trim(Sess0.Screen.GetString(24,2,7))= "" or Do While Trim(Sess0.Screen.GetString(24,2,7))<> "DESIRED". Given the discussion that works when the system is slower, but how do I get the macro to function properly when it runs faster then Extra will recognize?
I am really grasping at straws here and haven't been able to find anything to help out. A friend of mine suggested using the host settle time but that doesn't always work because A) I can't get it to hook into my excel and B) sometimes the screens change slower then the 30 second time out.
Right now the only method I have found that works to slow the macro down enough for it to function in Extra is the following:
Private Sub Timeout()
On Error Resume Next
Sess0.WindowState = 0
'minimizes Extra so Excel can be used
Application.Wait Now + TimeValue("00:00:02")
'Should make macro pause for 2 seconds
Sess0.WindowState = 2
'Maximizes Extra and continues
End Sub
This is called as a pause is needed but it won't and doesn't slow the macro down by 2 seconds. I used to use window states 4 and 1 however there are constant error codes when I run that and the resume next doesn't do anything.
Any ideas on how to solve this items?
Do while Sess0.Screen.OIA.Xstatus <> 0
Doevents
Loop
But Extra runs the macro so fast it won't recognize a wait string.
I tried using Do While and Do Unitl loops but then the macro will sometimes skip a step and screw up. Most recently I have started to use If <> variable then goto Start. Clunky and still doesn't catch everything.
For example there is one screen where the macro will not enter a new screen name unless a pause is built in. Without the pause it skips the new screen name and just hits enter which goes to the wrong screen.
In thread 1-1261727 there is discussion on how to run code based off of Do While Trim(Sess0.Screen.GetString(24,2,7))= "" or Do While Trim(Sess0.Screen.GetString(24,2,7))<> "DESIRED". Given the discussion that works when the system is slower, but how do I get the macro to function properly when it runs faster then Extra will recognize?
I am really grasping at straws here and haven't been able to find anything to help out. A friend of mine suggested using the host settle time but that doesn't always work because A) I can't get it to hook into my excel and B) sometimes the screens change slower then the 30 second time out.
Right now the only method I have found that works to slow the macro down enough for it to function in Extra is the following:
Private Sub Timeout()
On Error Resume Next
Sess0.WindowState = 0
'minimizes Extra so Excel can be used
Application.Wait Now + TimeValue("00:00:02")
'Should make macro pause for 2 seconds
Sess0.WindowState = 2
'Maximizes Extra and continues
End Sub
This is called as a pause is needed but it won't and doesn't slow the macro down by 2 seconds. I used to use window states 4 and 1 however there are constant error codes when I run that and the resume next doesn't do anything.
Any ideas on how to solve this items?