View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Activate Non-Excel Window Through VBA

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


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com


"Mark Bigelow" wrote in message
...
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!