Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Multiple Sendkeys not working... need help to condense code

I'm using the sendkeys command to send different key strokes to an outside
program already running. Normally this isn't an issue except for this macro
i'm putting together i have 20+ sendkeys in a row just to get to where i need
the cursor. I looked in MS Help files and it said to just put a space
between the key and how many strokes but either vb gives me a code error or
it puts some combination of the word tab and the number used or "tabs" once
then the number.

here is an example of what I was trying to do;
main.screen.sendkeys ("<tab 20") this just puts the word and number into
the program instead of the actuall key stroke. I've tried all different
kinds of combinations to get it to work but without luck. Also, the sendkeys
command for it to work that i've seen so far is to have the key setup like so
("<KEY").

Anyone have any ideas on how i can condense my many sendkeys commands?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Multiple Sendkeys not working... need help to condense code

Using SendKeys to send keystrokes to an app is like pitching in softball:

You need to allow the catcher time to catch the balls!

After each SendKeys statement, put a DoEvents.

This runs the app briefly (to process the keystroke)
--
Gary''s Student - gsnu200856


"Mr. m0le" wrote:

I'm using the sendkeys command to send different key strokes to an outside
program already running. Normally this isn't an issue except for this macro
i'm putting together i have 20+ sendkeys in a row just to get to where i need
the cursor. I looked in MS Help files and it said to just put a space
between the key and how many strokes but either vb gives me a code error or
it puts some combination of the word tab and the number used or "tabs" once
then the number.

here is an example of what I was trying to do;
main.screen.sendkeys ("<tab 20") this just puts the word and number into
the program instead of the actuall key stroke. I've tried all different
kinds of combinations to get it to work but without luck. Also, the sendkeys
command for it to work that i've seen so far is to have the key setup like so
("<KEY").

Anyone have any ideas on how i can condense my many sendkeys commands?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Multiple Sendkeys not working... need help to condense code

I wasn't aware of this command as I'm new to coding but this doesn't make a
difference for this instance.

"Gary''s Student" wrote:

Using SendKeys to send keystrokes to an app is like pitching in softball:

You need to allow the catcher time to catch the balls!

After each SendKeys statement, put a DoEvents.

This runs the app briefly (to process the keystroke)
--
Gary''s Student - gsnu200856


"Mr. m0le" wrote:

I'm using the sendkeys command to send different key strokes to an outside
program already running. Normally this isn't an issue except for this macro
i'm putting together i have 20+ sendkeys in a row just to get to where i need
the cursor. I looked in MS Help files and it said to just put a space
between the key and how many strokes but either vb gives me a code error or
it puts some combination of the word tab and the number used or "tabs" once
then the number.

here is an example of what I was trying to do;
main.screen.sendkeys ("<tab 20") this just puts the word and number into
the program instead of the actuall key stroke. I've tried all different
kinds of combinations to get it to work but without luck. Also, the sendkeys
command for it to work that i've seen so far is to have the key setup like so
("<KEY").

Anyone have any ideas on how i can condense my many sendkeys commands?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Multiple Sendkeys not working... need help to condense code

You may or may not need to include a DoEvents, as GS suggests, but not after
each tab unless a tab is supposed to trigger something else, which I doubt.
You might need the first character as an ESC. Try this to get a feel

Sub test()
Dim sKeys As String
sKeys = "a" & vbTab & "b" & vbTab & vbTab & vbTab & "c"
Application.SendKeys sKeys

' place the cursor just after the appostrophe below and press F5
'
End Sub

Regards,
Peter T

"Mr. m0le" wrote in message
...
I'm using the sendkeys command to send different key strokes to an outside
program already running. Normally this isn't an issue except for this
macro
i'm putting together i have 20+ sendkeys in a row just to get to where i
need
the cursor. I looked in MS Help files and it said to just put a space
between the key and how many strokes but either vb gives me a code error
or
it puts some combination of the word tab and the number used or "tabs"
once
then the number.

here is an example of what I was trying to do;
main.screen.sendkeys ("<tab 20") this just puts the word and number
into
the program instead of the actuall key stroke. I've tried all different
kinds of combinations to get it to work but without luck. Also, the
sendkeys
command for it to work that i've seen so far is to have the key setup like
so
("<KEY").

Anyone have any ideas on how i can condense my many sendkeys commands?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Multiple Sendkeys not working... need help to condense code

This will work if i edit what you put to make a variable with the different
key stroke combinations but still not quite what i was looking for. What i
really was try to see if it was possible was to just have one singe command
that used the key stroke a defined number of times.

ie. ("<Tab 20") will enter the tab key for 20 strokes....

Either i'm missing something or the application I'm working with doesn't
allow for this type of command to run and i'm stuck with making variable sets.

"Peter T" wrote:

You may or may not need to include a DoEvents, as GS suggests, but not after
each tab unless a tab is supposed to trigger something else, which I doubt.
You might need the first character as an ESC. Try this to get a feel

Sub test()
Dim sKeys As String
sKeys = "a" & vbTab & "b" & vbTab & vbTab & vbTab & "c"
Application.SendKeys sKeys

' place the cursor just after the appostrophe below and press F5
'
End Sub

Regards,
Peter T

"Mr. m0le" wrote in message
...
I'm using the sendkeys command to send different key strokes to an outside
program already running. Normally this isn't an issue except for this
macro
i'm putting together i have 20+ sendkeys in a row just to get to where i
need
the cursor. I looked in MS Help files and it said to just put a space
between the key and how many strokes but either vb gives me a code error
or
it puts some combination of the word tab and the number used or "tabs"
once
then the number.

here is an example of what I was trying to do;
main.screen.sendkeys ("<tab 20") this just puts the word and number
into
the program instead of the actuall key stroke. I've tried all different
kinds of combinations to get it to work but without luck. Also, the
sendkeys
command for it to work that i've seen so far is to have the key setup like
so
("<KEY").

Anyone have any ideas on how i can condense my many sendkeys commands?






  #6   Report Post  
Posted to microsoft.public.excel.programming
r r is offline
external usenet poster
 
Posts: 125
Default Multiple Sendkeys not working... need help to condense code

Application.SendKeys "{TAB 20}"

regards
r

Il mio ultimo lavoro ...
http://excelvba.altervista.org/blog/...ternative.html


"Mr. m0le" wrote:

I'm using the sendkeys command to send different key strokes to an outside
program already running. Normally this isn't an issue except for this macro
i'm putting together i have 20+ sendkeys in a row just to get to where i need
the cursor. I looked in MS Help files and it said to just put a space
between the key and how many strokes but either vb gives me a code error or
it puts some combination of the word tab and the number used or "tabs" once
then the number.

here is an example of what I was trying to do;
main.screen.sendkeys ("<tab 20") this just puts the word and number into
the program instead of the actuall key stroke. I've tried all different
kinds of combinations to get it to work but without luck. Also, the sendkeys
command for it to work that i've seen so far is to have the key setup like so
("<KEY").

Anyone have any ideas on how i can condense my many sendkeys commands?

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Multiple Sendkeys not working... need help to condense code

All this does is put {Tab 20} as text into the application...

"r" wrote:

Application.SendKeys "{TAB 20}"

regards
r

Il mio ultimo lavoro ...
http://excelvba.altervista.org/blog/...ternative.html


"Mr. m0le" wrote:

I'm using the sendkeys command to send different key strokes to an outside
program already running. Normally this isn't an issue except for this macro
i'm putting together i have 20+ sendkeys in a row just to get to where i need
the cursor. I looked in MS Help files and it said to just put a space
between the key and how many strokes but either vb gives me a code error or
it puts some combination of the word tab and the number used or "tabs" once
then the number.

here is an example of what I was trying to do;
main.screen.sendkeys ("<tab 20") this just puts the word and number into
the program instead of the actuall key stroke. I've tried all different
kinds of combinations to get it to work but without luck. Also, the sendkeys
command for it to work that i've seen so far is to have the key setup like so
("<KEY").

Anyone have any ideas on how i can condense my many sendkeys commands?

  #8   Report Post  
Posted to microsoft.public.excel.programming
r r is offline
external usenet poster
 
Posts: 125
Default Multiple Sendkeys not working... need help to condense code

I believe that you can only
"<Tab<Tab<Tab<Tab<Tab<Tab<Tab<Tab<Tab<Tab <Tab<Tab<Tab<Tab<Tab<Tab<Tab<Tab<Tab<Tab "
regards
r

Il mio ultimo lavoro ...
http://excelvba.altervista.org/blog/...ternative.html


"Mr. m0le" wrote:

All this does is put {Tab 20} as text into the application...

"r" wrote:

Application.SendKeys "{TAB 20}"

regards
r

Il mio ultimo lavoro ...
http://excelvba.altervista.org/blog/...ternative.html


"Mr. m0le" wrote:

I'm using the sendkeys command to send different key strokes to an outside
program already running. Normally this isn't an issue except for this macro
i'm putting together i have 20+ sendkeys in a row just to get to where i need
the cursor. I looked in MS Help files and it said to just put a space
between the key and how many strokes but either vb gives me a code error or
it puts some combination of the word tab and the number used or "tabs" once
then the number.

here is an example of what I was trying to do;
main.screen.sendkeys ("<tab 20") this just puts the word and number into
the program instead of the actuall key stroke. I've tried all different
kinds of combinations to get it to work but without luck. Also, the sendkeys
command for it to work that i've seen so far is to have the key setup like so
("<KEY").

Anyone have any ideas on how i can condense my many sendkeys commands?

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Multiple Sendkeys not working... need help to condense code

Yeah, it looks that way. I ended up creating several variables for the tab
amounts i needed.

"r" wrote:

I believe that you can only
"<Tab<Tab<Tab<Tab<Tab<Tab<Tab<Tab<Tab<Tab <Tab<Tab<Tab<Tab<Tab<Tab<Tab<Tab<Tab<Tab "
regards
r

Il mio ultimo lavoro ...
http://excelvba.altervista.org/blog/...ternative.html


"Mr. m0le" wrote:

All this does is put {Tab 20} as text into the application...

"r" wrote:

Application.SendKeys "{TAB 20}"

regards
r

Il mio ultimo lavoro ...
http://excelvba.altervista.org/blog/...ternative.html


"Mr. m0le" wrote:

I'm using the sendkeys command to send different key strokes to an outside
program already running. Normally this isn't an issue except for this macro
i'm putting together i have 20+ sendkeys in a row just to get to where i need
the cursor. I looked in MS Help files and it said to just put a space
between the key and how many strokes but either vb gives me a code error or
it puts some combination of the word tab and the number used or "tabs" once
then the number.

here is an example of what I was trying to do;
main.screen.sendkeys ("<tab 20") this just puts the word and number into
the program instead of the actuall key stroke. I've tried all different
kinds of combinations to get it to work but without luck. Also, the sendkeys
command for it to work that i've seen so far is to have the key setup like so
("<KEY").

Anyone have any ideas on how i can condense my many sendkeys commands?

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Multiple Sendkeys not working... need help to condense code

Dim sKeys As String
Dim n as long
n = 20
sKeys = "A" & String(n, vbTab) & "B"
application.sendkeys sKeys

Regards,
Peter T


"Mr. m0le" wrote in message
...
Yeah, it looks that way. I ended up creating several variables for the
tab
amounts i needed.

"r" wrote:

I believe that you can only
"<Tab<Tab<Tab<Tab<Tab<Tab<Tab<Tab<Tab<Tab <Tab<Tab<Tab<Tab<Tab<Tab<Tab<Tab<Tab<Tab "
regards
r

Il mio ultimo lavoro ...
http://excelvba.altervista.org/blog/...ternative.html


"Mr. m0le" wrote:

All this does is put {Tab 20} as text into the application...

"r" wrote:

Application.SendKeys "{TAB 20}"

regards
r

Il mio ultimo lavoro ...
http://excelvba.altervista.org/blog/...ternative.html


"Mr. m0le" wrote:

I'm using the sendkeys command to send different key strokes to an
outside
program already running. Normally this isn't an issue except for
this macro
i'm putting together i have 20+ sendkeys in a row just to get to
where i need
the cursor. I looked in MS Help files and it said to just put a
space
between the key and how many strokes but either vb gives me a code
error or
it puts some combination of the word tab and the number used or
"tabs" once
then the number.

here is an example of what I was trying to do;
main.screen.sendkeys ("<tab 20") this just puts the word and
number into
the program instead of the actuall key stroke. I've tried all
different
kinds of combinations to get it to work but without luck. Also,
the sendkeys
command for it to work that i've seen so far is to have the key
setup like so
("<KEY").

Anyone have any ideas on how i can condense my many sendkeys
commands?





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
SendKeys not working for some program Oshikawa Excel Programming 0 April 28th 09 08:19 PM
condense code for gridelines SITCFanTN New Users to Excel 1 June 30th 06 02:31 PM
Condense Code Nigel Excel Programming 2 December 22nd 05 11:59 PM
SendKeys {HOME} not working RB Smissaert Excel Programming 9 December 11th 03 01:27 AM
appactivate sendkeys not working with accelerator RB Smissaert Excel Programming 4 August 12th 03 08:31 PM


All times are GMT +1. The time now is 08:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"