Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
sendkey help needed
Secondary question, what sendkey command does select all, copy etc? Is
there a list of sendkey commands somewhere? Dave |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sports Comp Ladder tabulating help needed | Excel Worksheet Functions | |||
Little more help needed for my IF formula | Excel Discussion (Misc queries) | |||
VLOOKUP help needed! | Excel Worksheet Functions | |||
IF / Else Format help needed | Excel Worksheet Functions | |||
Custom percent format needed | Excel Worksheet Functions |