Hi Tom,

    Thanks, I did it quick last night for chip since he did not have Word 
2007. I first looked at what names were listed and 31 names came up for Word 
2007 and 2 of them were for the Status Bar. When searching for that 2 word 
name, with a space between, I came up with the same clip data for both. 
Assuming that probably one child is for the first pain and the second one 
for a split screen having 2 windows, I just chose the first one for now.

    Having said that, I will look at your suggestion if I have time and see 
if Word 2007 will come up with the same wtStatus results and works in 
getting the collection for Word 2007.

    All I was wondering about and going to look into is when can the second 
status bar be used; assuming it is for a split screen and don't really know.

    It was a quick solution for Chip's question and I gave him a list of all 
the window names on the Word 2007 first screen that had no entries since the 
word for status bar is different in each Office Word. I just posted it just 
in case someone else wanted a quick page line number routine; Word 2007 
numbers lines if you set it up to display it inside the setup section of the 
menu. For the status bar only gives page numbers and word count; and maybe 
more depending on settings.

    I am sure that is why you mentioned to use that form and maybe it will 
work for all of them, which it probably is true, but who trusts Microsoft 
for being standard???

    Having this may help in other future programs and searches...figuring 
out the top level convention to get to children as you mentioned.

    thanks Tom, when I get time I will test it out and see what else can 
come up using this method.

        Sincerely
        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
>
>

Reply via email to