Q: Changing focus back to Word after AppActivate

E

Edward Luhn

I'm trying to send pause commands to RealPlayer while staying in Word
2000. (It's part of a transcribing project.) AppActivate and SendKeys
works great, but then the focus stays on the RealPlayer window instead
of switching back to Word. I need it to go back to Word automatically,
so I can keep typing without having to mess with the mouse.

Here's what I'm doing:

strThisDoc = ActiveDocument.Name
AppActivate "RealPlayer"
SendKeys "^p"
AppActivate strThisDoc

....What do I kick?
TIA
 
W

Word Heretic

G'day Edward Luhn <[email protected]>,

That app activate only makes that window the relative focus for that
APPLICATION, not the OS! Thus, you need a windows system call.

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


Edward Luhn reckoned:
 
E

Edward Luhn

Okay, though I thought that the focus returns to the calling app once
AppActivate is done (wait=false). Anyway, how do I do a Windows System
Call?
 
M

Martin Seelhofer

Hey Edward
Okay, though I thought that the focus returns to the calling app once
AppActivate is done (wait=false). Anyway, how do I do a Windows System
Call?

Just a quick thought before letting you dive into the Windows API:
Have you tried Application.Activate?


Cheers,
Martin
 
E

Edward Luhn

I tried this:

strThisDoc = ActiveDocument.Name
AppActivate "RealPlayer"
SendKeys "^p"
Windows(strThisDoc).Activate

Still no go. The focus won't switch back from RP to Word.

Me big dum nooby. I thought this would be simple.
 
M

Martin Seelhofer

Hey there
strThisDoc = ActiveDocument.Name
AppActivate "RealPlayer"
SendKeys "^p"
Windows(strThisDoc).Activate

Still no go. The focus won't switch back from RP to Word.

Hm, my suggestion was to use Application.Activate, though:

AppActivate "RealPlayer"
SendKeys "^p"
Application.Activate

Works well with W/XL/PPT2K3 (at least on my PC)...


HTH,
Martin
 

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