Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Trying to write an Excel macro that activates a currently running
application when that app's title-bar text isn't completely known. I've been able to do this in Word, because Word VBA exposes the "Tasks" collection, so I can loop through all running Tasks comparing their ..Name properties and activate the one I need, without necessarily specifying its entire title bar text -- rather, by using InStr() to check for a match. (See last para below if this is unclear.) But it looks like Excel VBA doesn't know about the Tasks collection. Is it called something else in Excel? Is there another way to get at it? For Excel, the "other app" I need to switch to is almost always Word. If our installation of Word were "normal" (ehh?), I could use AppActivate. Problem is, AppActivate requires a match to the *first* characters of the title-bar text, and in our office the title bar's text is the active document's name *followed* by Microsoft Word, e.g., "MyFile.doc - Microsoft Word." (When running the macro, I want the focus to switch to *whatever* file is open in Word, and that file varies, so I can’t hard-code its name. That's why I need to use InStr() and match only a portion of what's on the new app's title bar.) I know there's a way to disable that filename-leads-the-titlebar feature, but I’d rather keep it. Can I have my cake and eat it too? If my first paragraph is unclear, the Word macro that accomplishes this is: Dim TA As Task For Each TA In Tasks If InStr(TA.Name, "Smurf Delta") 0 Then TA.Activate Exit Sub End If Next TA Many thanks for any clues. ----------------------- Mark Tangard |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
AppActivate | Excel Programming | |||
Problem with AppActivate. | Excel Programming | |||
appactivate | Excel Programming | |||
appactivate | Excel Programming | |||
Return to xls app's MainMenu when help file is closed | Excel Programming |