From: thread on
hi all
i'm trying to activate vb function called sendkeys to proccess user
actions
the actions is taking place on web based system
from some reason after
sendkeys({ENTER})
the code doesnt continoue
this is the code
Dim i, J As Long
Range("A1").Select
While Selection.Font.ColorIndex = 4
Selection.Offset(1, 0).Select
Wend
Selection.Font.ColorIndex = 4
i = Selection.Cells
SendKeys "%{TAB}", True
SendKeys "{DEL}", True
SendKeys i, True
SendKeys "{ENTER}", True
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{TAB}", True
all the code after the enter doesnt work
any idea?
From: Basta1980 on
Hi Matthew,

Thanks for your comment on this. API and the corresponding coding something
which I'm not familiar with. Maybe, soom time soon, I will spend some time on
this.

Thnx

Basta

"Matthew Herbert" wrote:

> Basta,
>
> As noted by others on the thread, and from your observations, SendKeys is
> quite temperamental. Initially, when I used to use SendKeys I discovered
> issues with wait times and code debugging. For example, the "wait" argument
> of SendKeys never seemed to work, DoEvents sometimes did the trick, and
> Application.Wait or Sleep was almost always needed. Despite using these
> tricks to get SendKeys to work properly, I found it to be unreliable. (As a
> side note, I discovered that if I ran a procedure without any breakpoints, I
> could better test SendKeys; however, if I stopped or interrupted the code
> prior to a procedure completing its execution, then SendKeys never worked
> properly).
>
> Anyhow, I finally got so frustrated with SendKeys that I moved over to a
> number of API calls that work by grabbing handles to specific windows (i.e.
> windows, combo boxes, text boxes, etc.) and then sending messages to those
> handles. Though this was a significant investment in time and resources,
> I've never run into any SendKeys issues (including reliability).
>
> Best,
>
> Matthew Herbert
>
>
> "Helmut Meukel" wrote:
>
> > A DoEvents might not be enough.
> > I would use a call to SLEEP API function within a loop to avoid
> > freezing Excel.
> >
> > Declare Sub Sleep lib "kernel32" (ByVal dwMillisecs as Long)
> >
> > Sub Doze(Millisecs as long)
> > Dim i as Long
> > for i = 1 to Millisecs/10
> > Sleep(10) 'freeze your code for 10 milliseconds
> > next i
> > End Sub
> >
> > Depending on the sluggishness of your system, you may need to call
> > Doze with a value of up to 2000 (= 2 second) to allow the app getting
> > activated and able to receive the SendKeys.
> > Usually 200 to 300 should be sufficient.
> >
> > HTH.
> >
> > Helmut.
> >
> >
> > "Gary''s Student" <GarysStudent(a)discussions.microsoft.com> schrieb im
> > Newsbeitrag news:B04BB2A3-DFF4-4D7A-A0F1-25553A5C1AAA(a)microsoft.com...
> > > If the problem is intermittent, it may be a timing issue. Try putting a
> > > DoEvents between your statements
> > > --
> > > Gary''s Student - gsnu201002
> > >
> > >
> > > "Basta1980" wrote:
> > >
> > >> Hi all,
> > >>
> > >> I'm using a simple sendkey statement to paste (ctrl v) cell content to
> > >> another application. However when running the code it sometimes works (I can
> > >> see the cell content copied and pasted to the application) but most of the
> > >> times it just jumps from Excel to the other application and stops (so nothing
> > >> is pasted). Anybody got a clue what might be going on here?
> > >>
> > >>
> > >> Code =
> > >>
> > >> Gemini:
> > >>
> > >> AppActivate ("CSM - Citrix Presentation Server Client")
> > >> SendKeys ("{^V}"), True
> > >>
> > >> Kind regards,
> > >>
> > >> Basta
> >
> >
> > .
> >