PC Review


Reply
Thread Tools Rate Thread

Can SENDKEYS be used with a variable?

 
 
=?Utf-8?B?TWFydiBLZWFuZQ==?=
Guest
Posts: n/a
 
      27th Feb 2005
I am trying to use the following sendkeys command to step down a variable
number of lines:

SendKeys "{DOWN X}", True ' MOVE DOWN X NUMBER OF RECORDS OR LINES

I am getting an error. What's the correct syntax if I need to use a variable?

Thanks in advance.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?JzY5IENhbWFybw==?=
Guest
Posts: n/a
 
      27th Feb 2005
Hi, Marv.

Try something like the following:

X = 4
SendKeys "{DOWN " & X & "}", False ' Move down to 4th row.


Or if you want to use a loop that may terminate early depending upon a
certain criteria, try:

For idx = 0 To (X - 1)
SendKeys "{DOWN}", False ' Move down to next row.

If (certain_criteria) Then
Exit For
End If
Next idx

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)

- - -
When you see correct answers to your question, please sign in to Microsoft's
Online Community and mark these posts, so that all may benefit by filtering
on "Answered questions" and quickly finding the right answers to similar
questions.


"Marv Keane" wrote:

> I am trying to use the following sendkeys command to step down a variable
> number of lines:
>
> SendKeys "{DOWN X}", True ' MOVE DOWN X NUMBER OF RECORDS OR LINES
>
> I am getting an error. What's the correct syntax if I need to use a variable?
>
> Thanks in advance.

 
Reply With Quote
 
John Spencer (MVP)
Guest
Posts: n/a
 
      27th Feb 2005
What are you trying to do? Using SendKeys is usually not the best solution.

It is best to avoid SendKeys if you can; but IF you cannot, then you would need
to use a loop to do this. Probably something like:

Dim X as Integer
Dim iLoop as Integer

For iLoop = 1 to X
SendKeys "{DOWN}", True
Next iLoop

Marv Keane wrote:
>
> I am trying to use the following sendkeys command to step down a variable
> number of lines:
>
> SendKeys "{DOWN X}", True ' MOVE DOWN X NUMBER OF RECORDS OR LINES
>
> I am getting an error. What's the correct syntax if I need to use a variable?
>
> Thanks in advance.

 
Reply With Quote
 
David C. Holley
Guest
Posts: n/a
 
      27th Feb 2005
Encapsulate it in a loop

for i = 1 to x
SendKeys
next i

But, I would ask - What are you trying to accomplish? What is going on
that you need to setp down a number of lines? What's the big picture here?

David H

Marv Keane wrote:
> I am trying to use the following sendkeys command to step down a variable
> number of lines:
>
> SendKeys "{DOWN X}", True ' MOVE DOWN X NUMBER OF RECORDS OR LINES
>
> I am getting an error. What's the correct syntax if I need to use a variable?
>
> Thanks in advance.

 
Reply With Quote
 
=?Utf-8?B?U2FjQ291cnQ=?=
Guest
Posts: n/a
 
      12th May 2005

Dim I as String

I = "{DOWN 2}"

Sendkeys "SendKeys "{DOWN}" & I & "{DOWN}", True

Good examples for For Next Loops. However, SendKeys can be used to have
variables in the comand.






"Marv Keane" wrote:

> I am trying to use the following sendkeys command to step down a variable
> number of lines:
>
> SendKeys "{DOWN X}", True ' MOVE DOWN X NUMBER OF RECORDS OR LINES
>
> I am getting an error. What's the correct syntax if I need to use a variable?
>
> Thanks in advance.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sendkeys, sending variable =?Utf-8?B?QnJlbnQ=?= Microsoft Excel Programming 1 17th May 2007 03:25 AM
SendKeys variable snax500 Microsoft Excel Programming 1 8th Mar 2007 03:17 PM
Mcr Variable SendKeys to a GUI =?Utf-8?B?U2VuZXhpcw==?= Microsoft Access Macros 0 2nd Nov 2006 12:19 PM
Variable SendKeys to a GUI =?Utf-8?B?U2VuZXhpcw==?= Microsoft Access VBA Modules 0 31st Oct 2006 08:34 PM
SendKeys Problem(s): SendKeys(str) drops period; Tone configurable? Joe W Larson Microsoft Dot NET Compact Framework 5 3rd Jun 2005 12:59 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:57 AM.