Create a VERY custom command button in Word XP

  Chris the Ancient 10:56 08 Feb 11

I'm in an investigative mood today!

Running Word XP Pro Developer in Windows XP Pro.

Because I am writing a document where I don't want widows and orphans - in some documents only, and I am lazy, I have added, to one of my custom toolbars two buttons... 'Widows and Orphans Off' and 'Widows and Orphans On'.

So far, simplez.

What I would like to find/discover is a way of having a clickable button and next to it a separate tell-tale that toggles between 'On' and 'Off'.

I have had a look in Google and I can't see anything (wrong search expression?) resembling what I want to do.

Any thoughts/ideas/solutions please?


  VoG II 11:05 08 Feb 11

Hi Chris.


With Selection.ParagraphFormat
.WidowControl = Not .WidowControl
End With

  Chris the Ancient 11:42 08 Feb 11

Hi VoG™

That bit of code works fine. Great stuff.

Any thoughts on how to give an indication, in the toolbar of the state?


  VoG II 12:40 08 Feb 11

It would be something like

With Selection.ParagraphFormat
.widowcontrol = Not .widowcontrol
CommandBars("My toolbar").Controls(1).FaceId = IIf(.widowcontrol, 316, 317)
End With

You'll need to change the name of the commandbar, control number and possibly the faceid numbers

  Chris the Ancient 12:49 08 Feb 11


That will take some playing with... after lunch.

But I see where you're leading me.

I have done similar, a very long time ago; and I shall have to delve into a fair bit of past archives as well as play and experiment for a while.

And I'm supposed to be working!

If all else fails, I'll get the button to flash up a timed message box giving the state 'changed to' as a way out of it.

As it may be a while before I get near the end of this experiment, and I can see a way ahead, I will mark as resolved for now.

Many thanks, VoG™. You're a gentleman and a scholar.


  Chris the Ancient 14:21 08 Feb 11

... which isn't perfect - but it will do.

Searching around the net, I found a couple of icons to denote widow- or orphan-controlled. Drew them as Word toolbar icons and I'm using them.

As with a lot ot Word toolbar icons, a little vague - but at least I know what they mean.

This thread is now locked and can not be replied to.

Surface Pro (2017) vs Surface Pro 4

20 groundbreaking 3D animation techniques

How to mine Bitcoin on Mac