Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default SendKeys Trouble

I've got an excel spreadsheet that I'm trying to toggle between two
applications. The second application takes up the whole screen and doesn't
allow the start bar to come backup. It's a measuring application and the
screen has to be a certain size so no it can't be changed. You can alt tab
back and forth between the two while it's running no problem.

This is the code I tried to run and it worked 2-3 time so I put it in the
production routine and now it works sometimes other times the Numlock caption
comes up on the screen and nothing happens. What the sub is doing is
toggling between two apps. It minimizes XL and then Maximizes the second
application.

Is there a better way to do this?

TIA
D
Sub Run()
Dim stProgram As String
stProgram = Range("Application").Value
Application.WindowState = xlMinimized

AppActivate (stProgram)
DoEvents
SendKeys "%" & Chr$(vbKeySpace) & "X"

Application.Wait (Now + TimeValue("0:00:03"))

AppActivate (stProgram)
DoEvents
SendKeys "%" & Chr$(vbKeySpace) & "N"

Application.Wait (Now + TimeValue("0:00:03"))

Application.WindowState = xlNormal

End Sub




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default SendKeys Trouble

I found this link and it works great!

http://vbnet.mvps.org/index.html?cod...estorehwnd.htm

Dennis

"MTechG" wrote:

I've got an excel spreadsheet that I'm trying to toggle between two
applications. The second application takes up the whole screen and doesn't
allow the start bar to come backup. It's a measuring application and the
screen has to be a certain size so no it can't be changed. You can alt tab
back and forth between the two while it's running no problem.

This is the code I tried to run and it worked 2-3 time so I put it in the
production routine and now it works sometimes other times the Numlock caption
comes up on the screen and nothing happens. What the sub is doing is
toggling between two apps. It minimizes XL and then Maximizes the second
application.

Is there a better way to do this?

TIA
D
Sub Run()
Dim stProgram As String
stProgram = Range("Application").Value
Application.WindowState = xlMinimized

AppActivate (stProgram)
DoEvents
SendKeys "%" & Chr$(vbKeySpace) & "X"

Application.Wait (Now + TimeValue("0:00:03"))

AppActivate (stProgram)
DoEvents
SendKeys "%" & Chr$(vbKeySpace) & "N"

Application.Wait (Now + TimeValue("0:00:03"))

Application.WindowState = xlNormal

End Sub




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
SendKeys [email protected] Excel Programming 1 July 25th 05 06:05 PM
Sendkeys Jim Excel Programming 1 April 16th 05 06:44 PM
SendKeys Mike Excel Programming 2 July 2nd 04 12:47 AM
Trouble with SendKeys Yo Excel Programming 0 January 23rd 04 09:20 PM
Sendkeys GB[_3_] Excel Programming 0 September 16th 03 10:39 PM


All times are GMT +1. The time now is 11:38 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"