#1   Report Post  
Posted to microsoft.public.excel.misc
Ryk Ryk is offline
external usenet poster
 
Posts: 36
Default sendkey help needed

I have a project where I need to interact with a program and grab data.

I can make it grab it once, but have to reset it to do a second one,
and I think its because I don't know how to make a send key tab one
backwards.

I have a column of numbers in A, I tab to next screen, and the first
cell is where I need drop the data, then I tab once, and hit enter to
get my needed info. I am making no headway with this, but here is what
I have tried....

Sub GetData()
Dim Data As String
Data = ActiveCell.Value
' go down a row
ActiveCell.Offset(1, 0).Select
' flip back to previous window
SendKeys "%{tab}", True
' enter the Data
SendKeys Data, True
SendKeys "{tab}", True
' send it
SendKeys "{enter}", True
' need next line to tab back to last cell (not working)
SendKeys "{tab}", True
SendKeys "%{tab}", True
End Sub


For some reason it repeats the data it first grabbed over and over.

Thanks for any help.

Dave

  #2   Report Post  
Posted to microsoft.public.excel.misc
Ryk Ryk is offline
external usenet poster
 
Posts: 36
Default sendkey help needed

Secondary question, what sendkey command does select all, copy etc? Is
there a list of sendkey commands somewhere?

Dave

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 434
Default sendkey help needed

hi, Ryk !

Secondary question, what sendkey command does select all, copy etc?
Is there a list of sendkey commands somewhere?


your previously posted code [with minor corrections -uppercase-] is working [for me] as follows:

Sub GetData()
Dim Data As String
Data = ActiveCell.Value ' ANY NUMBER
' go down a row
ActiveCell.Offset(1, 0).Select
' flip back to previous window [THE CALCULATOR]
SendKeys "%{tab}", True
' enter the Data AND MULTIPLY IT BY 5
SendKeys Data & "*5{enter}", True
' get result
SendKeys "^c", True
' need next line to {ALT} tab back to last cell (IS working NOW)
SendKeys "%{tab}", True
' paste calculator result
SendKeys "^v{esc}"
End Sub

hth,
hector.


  #4   Report Post  
Posted to microsoft.public.excel.misc
Ryk Ryk is offline
external usenet poster
 
Posts: 36
Default sendkey help needed


Héctor Miguel wrote:
hi, Ryk !

Secondary question, what sendkey command does select all, copy etc?
Is there a list of sendkey commands somewhere?


your previously posted code [with minor corrections -uppercase-] is working [for me] as follows:

Sub GetData()
Dim Data As String
Data = ActiveCell.Value ' ANY NUMBER
' go down a row
ActiveCell.Offset(1, 0).Select
' flip back to previous window [THE CALCULATOR]
SendKeys "%{tab}", True
' enter the Data AND MULTIPLY IT BY 5
SendKeys Data & "*5{enter}", True
' get result
SendKeys "^c", True
' need next line to {ALT} tab back to last cell (IS working NOW)
SendKeys "%{tab}", True
' paste calculator result
SendKeys "^v{esc}"
End Sub

hth,
hector.


This is interesting as I read it, but I am unsure now how to change it
to fit, you see the data window has 2 tab stops, one to enter data,
then if I tab over and hit enter on a Run Data button, it processes the
info, (unlike calculator, with one cell) the problem is I do not know
how to make it tab back to the first cell, so I can re-run the macro
with new data. The calculator thing does work well, and I can use this
on another project i am sure, but for this one the tab to the left is
needed. I also dearly need a "copy all" for this, because the data,
when returned is in a list, and if I copy the sheet (external data
sheet) and paste to a blank excel sheet, the data I need is always in
same cell. My plan was this, copy the sheet, move it to blank sheet,
copy that cell, enter that on my Data sheet, delete the blank sheet,
and loop this. On my (sheet 1) the info I work this is column A, so
grab data (sheet 1) A1, flip to (external data sheet), paste (in first
cell), tab right hit enter, copy the (external data sheet), tab back
one left(to be ready for next loop), flip to excel blank excel
sheet(lets call it Sheet 2), paste, grab data from (Sheet 2) D14, move
back to (sheet 1), move one cell right. paste data, offset back to A
but down one row, clear data from (Sheet 2), and be ready to start it
all over. But as the external data sheet is not windows or excel, the
send keys have to be used in this. Hector, I hope this helps explain
better.

Dave

  #5   Report Post  
Posted to microsoft.public.excel.misc
Ryk Ryk is offline
external usenet poster
 
Posts: 36
Default sendkey help needed


Seems I also need to clear the first cell in the external page, before
I paste data to it, it doesn't allow copy over?

Dave

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
Sports Comp Ladder tabulating help needed shaunl Excel Worksheet Functions 12 January 29th 14 01:25 PM
Little more help needed for my IF formula Greg Excel Discussion (Misc queries) 4 February 28th 06 11:16 PM
VLOOKUP help needed! MartinC Excel Worksheet Functions 1 January 12th 06 12:46 PM
IF / Else Format help needed Paul B. Excel Worksheet Functions 5 January 5th 06 06:37 PM
Custom percent format needed Will Fleenor Excel Worksheet Functions 1 June 29th 05 02:57 AM


All times are GMT +1. The time now is 03:36 PM.

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

About Us

"It's about Microsoft Excel"