Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using sendkeys, sending data from textbox

Status
Not open for further replies.

kalle82

Technical User
Apr 2, 2009
163
SE
Hi!

Im using the following code to open another application.
Works fine it´s really slow but it works.

Now i want to use values I gathered in my userform and send them to the program i opened, but i dont know how...

And is there another way of speeding this up sendkeys is very very slow...

Code:
Sub openjetform()

Dim MyAppID, ReturnValue
Dim DataToSend As String

DataToSend = "some data you want to send to other app"

ReturnValue = Shell("C:\Program\JetForm\filler.exe", vbHide)
AppActivate ReturnValue

    Dim AltKey As String
    Dim CtrlKey As String
    Dim ShiftKey As String
    Dim TabKey As String
    Dim EnterKey As String
    '--------------------------
    AltKey = "%"
    CtrlKey = "^"
    ShiftKey = "+"
    TabKey = "{TAB}"
    EnterKey = "~"
    '--------------------------
    start = 0
 StopTime = 30000000
  While start < StopTime
       start = start + 1
    Wend
'- Öppna alla förfrågningar
    
    SendKeys CtrlKey & "(o)", False


'- Välj förfrågan arbetsgivare

SendKeys "*.*" + EnterKey

SendKeys ShiftKey + TabKey

SendKeys "{DOWN}"

SendKeys EnterKey

SendKeys TabKey
SendKeys TabKey
SendKeys TabKey

'[b] This is where I want to the value of my textbox[/b]

SendKeys textbox15.value or the value of the variable namnet

End Sub

Really tricky grateful for any tips, and YES I have read the faq in here!
 
is there another way of speeding this up
Get rid of the While start ... Wend loop
and have a look at the second parameter of the SendKeys function.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Okay PHV! I got rid of the wendkeys, the only problem is that I think the executed program loads to slow, because nothing happens now... Is there a more direct way of interacting with the opened program. Sendkeys reliability is really bad, they dont even work every time....

Is there a way of forcing it to work, or controling it, or are there method by which i can call the menus in the program? So that it works everytime?

Thanks for the answer above :)

Carl

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top