PDA

View Full Version : Insert a box with 'x' inside?



let98007
10-19-2009, 12:56 PM
I inherited a document from a client that needs to be modified to show one of multiple options as permanently selected. Each option is a paragraph beginning with a check box symbol. My task is to replace the existing symbol of an empty box with a box that has an 'x' in it. It sounds simple, but has already consumed more time than I care to admit. Does such a character exist?

fumei
10-19-2009, 02:43 PM
Yes. Have you looked in the Insert Symbols dialog. It is a WingDing character, so you should likely have it.

let98007
10-20-2009, 08:41 AM
Thanks! I thought it should be there and searched the Symbol font set finding only the empty box. The Wingdings fonts aren't installed on the client machines but I'll see if I can get the IT folks to add them. I created a .jpg to use in the meantime but a font is definitely preferable.

Thanks again for your help.

fumei
10-20-2009, 12:33 PM
I thought WingDing was a standard installed font, but of course it could have been removed.

Paul_Hossler
10-28-2009, 06:37 PM
An option that doesn't require WingDings would be to insert a EQ field to draw a box around an X formatted in Arial (or something ele)


{ EQ \X(X) }


Of course you need to use Ctrl-F9 to insert the special Field Braces

Paul

fumei
10-29-2009, 11:39 AM
Paul, very nice!

let98007, here is VBA that does Paul's insertion. Note that the font characteristics (font, size) will be whatever is the current setting for the paragraph style the Selection is in.
With Selection
.Fields.Add Range:=Selection.Range, _
Type:=wdFieldEmpty, _
PreserveFormatting:=False
.TypeText Text:="EQ \X(X)"
End With
You could easily do this by using a dedicated Style:
With Selection
.Style = "Boxed"
.Fields.Add Range:=Selection.Range, _
Type:=wdFieldEmpty, _
PreserveFormatting:=False
.TypeText Text:="EQ \X(X)"
End With
where I made a dedicated Style - "Boxed" - of Arial, 8 pts.

Note also, that after the code executes the Selection (cursor) is before the boxed "X".

fumei
10-29-2009, 11:48 AM
Paul, just as an added comment, that is a very cute way to easily add a "boxed" string.
Dim strIn As String
strIn = InputBox("Type some text.")
With Selection
.Fields.Add Range:=Selection.Range, _
Type:=wdFieldEmpty, _
PreserveFormatting:=False
.TypeText Text:="EQ \X(" & strIn & ")"
End With
Voila! The text is boxed. I rarely use the EQ field and was unaware of this field switch. Learn something every day. I am not sure how often this could be useful, but it is something I will store in the tool...ahem..box.

Paul_Hossler
10-29-2009, 12:56 PM
Making the field an Autotext entry would be a non-VBA way to insert a boxed X field, or other predetermined char. I use a macro similar to yours to 'box' the selection.

Paul

fumei
10-29-2009, 01:24 PM
Oh I seriously think if the OP requires this even once in a while, it would DEFINITELY be a very good idea to have it as an AutoText!