Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to use vba to launch a file (external application) and
when it has launched press F9. My code below launches the file and it is visible but it doesn't hit F9. When I look at my taskbar it is the spreadsheet that looks like it is active rather than the external app. Code: Sub OpenDashboard() Dim dReturnValue As Double dReturnValue = Shell("C:\Program Files\PRISM Europe\Dashboard \dashboard.exe G:\isosbsm\BST Service\Proactive Service Management \Wincharts\LPAS Dashboard.dsh") AppActivate dReturnValue SendKeys "{F9}", True End Sub Does anyone have any ideas? Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Jul 12, 9:25*am, Shazbot79
wrote: I am trying to use vba to launch a file (external application) and when it has launched press F9. My code below launches the file and it is visible but it doesn't hit F9. When *I look at my taskbar it is the spreadsheet that looks like it is active rather than the external app. Code: Sub OpenDashboard() * * Dim dReturnValue As Double * * dReturnValue = Shell("C:\Program Files\PRISM Europe\Dashboard \dashboard.exe G:\isosbsm\BST Service\Proactive Service Management \Wincharts\LPAS Dashboard.dsh") * * * * AppActivate dReturnValue * * * * SendKeys "{F9}", True End Sub Does anyone have any ideas? Thanks I use Sendkeys to automate another program that processes tickets from inside excel. The steps I use is: 1. shell out application 2. Activate Workbook "thisworkbook.activate" 3. Activate Application -- the code I use is Appactivate "TRIPS" <-- "TRIPS" being what the Caption is for the Window. You dont have to use the entire Caption, just the first part of which is unique to all other windows. 4. I normally have the application wait a few seconds so that Excel can flip over to the application: Application.Wait Now + TimeValue("00:00:02") 5. Then you can use Sendkeys; SendKeys cell.Offset(0, 3).Value SendKeys "{TAB 2}", True Or in your case SendKeys "{F9}", true Let me know if this helps you out. I think your next direction would be to simply your code. Shell out your app and see what the caption is for the window. After you succesfully shell it out, then you can work on sending keys. Remember that you must isolate Excel and your App and then flip between the 2 (depending if your needing a response to import back into excel or not). Great Luck! Dave |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Application.SendKeys & Printing | Excel Programming | |||
Close an application with sendkeys | Excel Programming | |||
The application SendKeys | Excel Programming | |||
SendKeys and Application.ScreenUpdating | Excel Programming | |||
Application.sendkeys | Excel Programming |