Activate Non-Excel Window Through VBA

M

Mark Bigelow

Hello!

I'd like to activate an Excel window (SAP) through VBA and then use
SendKeys to input the selection criteria for a certain report, and then
run the report. I think this will be easier than explaining how to run
the report.

So, how can I activate the window?

Thanks!
Mark

---
Mark Bigelow
mjbigelow at hotmail dot com
http://hm.imperialoiltx.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
C

Chip Pearson

Mark,

Try something like the following

Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Declare Function SetForegroundWindow Lib "user32" ( _
ByVal HWnd As Long) As Long


Sub AAA()
Dim HWnd As Long
HWnd = FindWindow(vbNullString, "SAP")
If HWnd Then
SetForegroundWindow HWnd
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top