Insert a box defaulted to "Checked"

L

Lori

I'm trying to create two buttons for a toolbar one that inserts a Forms check
unchecked and one that defaults to checked. The first I can record with
macro, but I'm at a loss when it comes to what to put for "With Selection",
obviously this didn't work:

Sub BoxChked()
Selection.FormFields.Add Range:=Selection.Range, Type:=wdFieldFormCheckBox
With Selection.DefaultValue
.Checked = True
End With
End Sub

~Lori
 
G

Greg Maxey

Sub BoxChked()
With Selection
.FormFields.Add Range:=Selection.Range, Type:=wdFieldFormCheckBox
.MoveStart wdCharacter, -1
.FormFields(1).CheckBox.Value = True
End Sub
 
G

Greg Maxey

Hmm...interesting.

Actually there might be a better approach. Create the checked box and
create an autotext entry. Name if chkbox.

This way you can insert it using:

1. The AutoText autocomplete funciton by typing chkb and hit enter,
2. Dragging the AutoText entry to a Toolbar
3. Use a macro:

Sub InsertCCB()
ActiveDocument.AttachedTemplate.AutoTextEntries("chkbox").Insert _
Where:=Selection.Range
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top