I have a SendKeys instance working currently - of course, it aint the purtiest way of doing things.
For what I am wanting to do, it seemed that SendKeys is the only way I could get it accomplished. So, it's working.
However, I would like to somehow (if possible using VBA) check to make sure the correct application is the active window, and that it is open in the first place. If it is not open, I would like to open and activate it, but only activate it and use the sendkeys command if it is already open. I tried searching around, but could not seem to find anything that explains how to check on an application being open.
The particular application to which I am sending the keystrokes is a web application on our company Intranet. And at least for now, I'm just doing this for my own good, as it wouldn't be something I could get approved by all levels for the entire company - I've recommended it before.
Without further ado, here is my current code using SendKeys:
I tried digging around for options with ActiveWindow and Shell, but couldn't find anything. Everything I could find for ActiveWindow seemed to only work with Excel (unless perhaps, I'm missing the correct reference to use that option). And for Shell, I couldn't find anything to say "is the application running?"
Also, in case it helps any, this specific Intranet application can only be opened in Internet Explorer. Our current version of Internet Explorer is 6.0.2900.2180.xpsp_sp2_gdr.....
Thanks for any suggestions, code snippets, references, explanations, etc.
--
"If to err is human, then I must be some kind of human!" -Me
For what I am wanting to do, it seemed that SendKeys is the only way I could get it accomplished. So, it's working.
However, I would like to somehow (if possible using VBA) check to make sure the correct application is the active window, and that it is open in the first place. If it is not open, I would like to open and activate it, but only activate it and use the sendkeys command if it is already open. I tried searching around, but could not seem to find anything that explains how to check on an application being open.
The particular application to which I am sending the keystrokes is a web application on our company Intranet. And at least for now, I'm just doing this for my own good, as it wouldn't be something I could get approved by all levels for the entire company - I've recommended it before.
Without further ado, here is my current code using SendKeys:
Code:
Private Sub cmdPaste_Click()
Dim x As Integer
x = 1
AppActivate "IntranetProgram"
SendKeys "%V"
SendKeys "R", 300
AppActivate "IntranetProgram"
SendKeys "{TAB 12}"
For x = 1 To 5
SendKeys "{TAB}", 10
SendKeys "158560941", 10
Next x
SendKeys "%s"
End Sub
I tried digging around for options with ActiveWindow and Shell, but couldn't find anything. Everything I could find for ActiveWindow seemed to only work with Excel (unless perhaps, I'm missing the correct reference to use that option). And for Shell, I couldn't find anything to say "is the application running?"
Also, in case it helps any, this specific Intranet application can only be opened in Internet Explorer. Our current version of Internet Explorer is 6.0.2900.2180.xpsp_sp2_gdr.....
Thanks for any suggestions, code snippets, references, explanations, etc.
--
"If to err is human, then I must be some kind of human!" -Me