+ Reply to Thread
Results 1 to 5 of 5

SendKeys to open application

  1. #1
    Arne Hegefors
    Guest

    SendKeys to open application

    Hi! I try to open a program from a macro in Excel and login (the Bloomberg
    professional, (not the website)) using SendKeys. With some help from other
    programmers I got the following code. It does not work at all though and I am
    lost. Can someone please help me with this? My problems are:

    1) I get error on the WaitFor line. Sub or Function has not been defined
    2) If I delete the WairFor line I get error on the
    AppActivate("1-BLOOMBERG") line. Illegal procedure call or argument


    Sub bbg_login()
    AppActivate("1-BLOOMBERG")
    Application.SendKeys "{BREAK}",false
    WaitFor timevalue("00:00:01")
    Application.SendKeys "user_Name", false
    Application.SendKeys "{TAB}", false
    Application.SendKeys "password", false
    Application.SendKeys "~", false
    End Sub


    Any help appreciated!



  2. #2
    NickHK
    Guest

    Re: SendKeys to open application

    Arne,
    "WaitFor" is not Excel/VBA. I suspect Access/VBA but not sure. One way is:
    Application.Wait Now + TimeValue("0:00:01")

    Also try removing the brackets from the appactivate statement.

    SendKeys is always going to be doubtful IMHO.

    NickHK

    "Arne Hegefors" <[email protected]> wrote in message
    news:[email protected]...
    > Hi! I try to open a program from a macro in Excel and login (the Bloomberg
    > professional, (not the website)) using SendKeys. With some help from

    other
    > programmers I got the following code. It does not work at all though and I

    am
    > lost. Can someone please help me with this? My problems are:
    >
    > 1) I get error on the WaitFor .line. "Sub or Function has not been

    defined"
    > 2) If I delete the WairFor line I get error on the
    > AppActivate("1-BLOOMBERG") line. "Illegal procedure call or argument"
    >
    >
    > Sub bbg_login()
    > AppActivate("1-BLOOMBERG")
    > Application.SendKeys "{BREAK}",false
    > WaitFor timevalue("00:00:01")
    > Application.SendKeys "user_Name", false
    > Application.SendKeys "{TAB}", false
    > Application.SendKeys "password", false
    > Application.SendKeys "~", false
    > End Sub
    >
    >
    > Any help appreciated!
    >
    >




  3. #3
    Arne Hegefors
    Guest

    Re: SendKeys to open application

    Hi! Thanks for your help! Yes SendKeys does not seem to be the most reliable
    method. Howver I have trouble finding any documentation on how to do this in
    some other manner. To me it seems like a standard procedure but I guess I am
    wrong. If you have tips for sites etc. that shows you how to do this using a
    better technique than SendKeys I would be most grateful! Thanks alot!

    "NickHK" skrev:

    > Arne,
    > "WaitFor" is not Excel/VBA. I suspect Access/VBA but not sure. One way is:
    > Application.Wait Now + TimeValue("0:00:01")
    >
    > Also try removing the brackets from the appactivate statement.
    >
    > SendKeys is always going to be doubtful IMHO.
    >
    > NickHK
    >
    > "Arne Hegefors" <[email protected]> wrote in message
    > news:[email protected]...
    > > Hi! I try to open a program from a macro in Excel and login (the Bloomberg
    > > professional, (not the website)) using SendKeys. With some help from

    > other
    > > programmers I got the following code. It does not work at all though and I

    > am
    > > lost. Can someone please help me with this? My problems are:
    > >
    > > 1) I get error on the WaitFor .line. "Sub or Function has not been

    > defined"
    > > 2) If I delete the WairFor line I get error on the
    > > AppActivate("1-BLOOMBERG") line. "Illegal procedure call or argument"
    > >
    > >
    > > Sub bbg_login()
    > > AppActivate("1-BLOOMBERG")
    > > Application.SendKeys "{BREAK}",false
    > > WaitFor timevalue("00:00:01")
    > > Application.SendKeys "user_Name", false
    > > Application.SendKeys "{TAB}", false
    > > Application.SendKeys "password", false
    > > Application.SendKeys "~", false
    > > End Sub
    > >
    > >
    > > Any help appreciated!
    > >
    > >

    >
    >
    >


  4. #4
    NickHK
    Guest

    Re: SendKeys to open application

    Arne,
    There was the reply to your other post "Active X log in".
    I never use this Bloomberg service, so I can't say, but john seems to know
    what he's talking about with the Bloomberg control.

    NickHK

    "Arne Hegefors" <[email protected]> wrote in message
    news:[email protected]...
    > Hi! Thanks for your help! Yes SendKeys does not seem to be the most

    reliable
    > method. Howver I have trouble finding any documentation on how to do this

    in
    > some other manner. To me it seems like a standard procedure but I guess I

    am
    > wrong. If you have tips for sites etc. that shows you how to do this using

    a
    > better technique than SendKeys I would be most grateful! Thanks alot!
    >
    > "NickHK" skrev:
    >
    > > Arne,
    > > "WaitFor" is not Excel/VBA. I suspect Access/VBA but not sure. One way

    is:
    > > Application.Wait Now + TimeValue("0:00:01")
    > >
    > > Also try removing the brackets from the appactivate statement.
    > >
    > > SendKeys is always going to be doubtful IMHO.
    > >
    > > NickHK
    > >
    > > "Arne Hegefors" <[email protected]> wrote in

    message
    > > news:[email protected]...
    > > > Hi! I try to open a program from a macro in Excel and login (the

    Bloomberg
    > > > professional, (not the website)) using SendKeys. With some help from

    > > other
    > > > programmers I got the following code. It does not work at all though

    and I
    > > am
    > > > lost. Can someone please help me with this? My problems are:
    > > >
    > > > 1) I get error on the WaitFor .line. "Sub or Function has not been

    > > defined"
    > > > 2) If I delete the WairFor line I get error on the
    > > > AppActivate("1-BLOOMBERG") line. "Illegal procedure call or argument"
    > > >
    > > >
    > > > Sub bbg_login()
    > > > AppActivate("1-BLOOMBERG")
    > > > Application.SendKeys "{BREAK}",false
    > > > WaitFor timevalue("00:00:01")
    > > > Application.SendKeys "user_Name", false
    > > > Application.SendKeys "{TAB}", false
    > > > Application.SendKeys "password", false
    > > > Application.SendKeys "~", false
    > > > End Sub
    > > >
    > > >
    > > > Any help appreciated!
    > > >
    > > >

    > >
    > >
    > >




  5. #5
    Registered User
    Join Date
    08-14-2006
    Posts
    29
    Arne,

    If you want to use timers in Excel VBA I always find that application.ontime is much more reliable and flexible. However that becomes irrelevant as I don't think sendkeys is what you need.

    Thanks
    Joe

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1