Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default 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 a

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default 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" wrote in message
...
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 a

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default 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" wrote in message
...
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 a

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default 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" wrote in message
...
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" wrote in

message
...
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 a

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default SendKeys to open application


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


--
LFCFan
------------------------------------------------------------------------
LFCFan's Profile: http://www.excelforum.com/member.php...o&userid=37484
View this thread: http://www.excelforum.com/showthread...hreadid=571335

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
Close an application with sendkeys ina Excel Programming 2 May 16th 06 08:15 AM
The application SendKeys Jim333[_6_] Excel Programming 2 August 17th 05 05:44 AM
SendKeys and Application.ScreenUpdating Michael Malinsky[_2_] Excel Programming 3 March 23rd 05 10:40 PM
SendKeys to a remote server application green78[_5_] Excel Programming 0 July 28th 04 08:19 PM
Application.sendkeys Adrie Rahanra Excel Programming 1 October 15th 03 04:29 PM


All times are GMT +1. The time now is 02:16 AM.

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"