Hi Again Tom,
It came up with a count of 0. I suspected this when Chip said something
was not normal. Also, the list of 31 names did not come up with wtStatus...
What I posted works for some windows so will see what happens in the
future.
Bruce
Sent: Monday, August 15, 2011 1:02 AM
Subject: Re: Reading Status Bar in Notepad and Word 2007
Here's a little more direct method to get a status bar when it's a
standard status bar window, as in Notepad. Note, in some programs it
will be a direct child and others it won't. So use DirectChildren or
Children as needed. You can find out quickly in the immediate mode
window. Although, if it is a direct child it will still be considered a
child as well. So check the direct children first. There are usually
many more children. So using DirectChildren will have to check fewer
window objects.
Set oStatusWindows = ActiveWindow.DirectChildren.FilterByType(wtStatus)
This will return a collection which may be more than one if it's an MDI
window.
Hth,
Tom
On 8/14/2011 11:21 PM, BT wrote:
>
> To All,
>
> There is more than one status bar in Word 2007 and the name is
> different
> than what is in Notepad so this is what I did to get it to speak the
> status
> bar in my Page_Num app to get the line and column number in Notepad and
> now
> at least the Page and word count in Word 2007.
>
> you have more than one status bar in Woord 2007 so do a loop and speak it.
> This is one of 2 methods to get the item number for the object in 2007 for
> it will not return an object until you know it's location.
>
> App Segment:
> dim objMainWindow, objStatusBarWindow, objResults
> set objMainWindow = activeWindow.overlap
> 'First Notepad:
> set objResults = objMainWindow.children.filterByName(
> "msctls_statusbar32")
> if not objResults is nothing then
> if objResults.count> 0 then
> ' Window Found!
> set objStatusBarWindow = objResults(1) ' where 1 is the location for
> the
> Status Bar object.
> SpeakStatusBar objStatusBarWindow
> Exit Sub
> end if
> end if
> ' Word 2007:
> set objResults = objMainWindow.children.filterByName( "status bar")
> if not objResults is nothing then
> ' Go through the collection of status bar objects.
> For Each objStatusBarWindow in objResults
> SpeakStatusBar objStatusBarWindow
> Exit Sub
> Next
> End If
> End Sub
>
> Sub SpeakStatusBar( oStatusbar)
> ' now speak contents of the object clips.
> ' First convert any text for easier reading.
> Dim txt: txt = oStatusbar.clips.clipstext
> txt = Replace( txt, "Ln", " Line ")
> txt = Replace( txt, "Col", " column ")
> txt = Replace( txt, ",", " ")
> Speak txt
> End Sub
>
>