Thank everyone very much for suggestions
I see the Macro coding, but I still don't know how to create a checkbox in
word.
I have tried to create a checkbox, but get no idea on how to work on the
macro coding related to this checkbox.
Does anyone have any suggestions on how to do it?
Thank everyone very much for any suggestions
Eric
http://addbalance.com/word/download.htm#PageStart >
http://addbalance.com/word/download/checkboxtemplate.zip >
CheckBox REF Substitute.doc
Macro Coding for checkbox
Option Explicit
Sub CopyCheckBoxMacro()
' Macro written by Charles Kenyon
' 21 December 2001 revised 11 January 2002
'
' Declare variables
Dim sCheck As String
Dim bCheck As Boolean
Dim sChecka As String
Dim sCheckb As String
'
' Get name and value of formfield which was just used and
' set variable for dependent formfield name
sCheck = Selection.FormFields.Item(1).Name
sChecka = sCheck & "a"
sCheckb = sCheck & "b"
bCheck = ActiveDocument.FormFields(sCheck).CheckBox.Value
'
' Unprotect document
ActiveDocument.Unprotect
'
' Set value for dependent checkboxes and reprotect document
ActiveDocument.FormFields(sChecka).CheckBox.Value = bCheck
ActiveDocument.FormFields(sCheckb).CheckBox.Value = bCheck
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End Sub
Option Explicit
Sub CopyCheckBoxMacro()
' Macro written by Charles Kenyon
' 21 December 2001 revised 11 January 2002
'
' Declare variables
Dim sCheck As String
Dim bCheck As Boolean
Dim sChecka As String
Dim sCheckb As String
'
' Get name and value of formfield which was just used and
' set variable for dependent formfield name
sCheck = Selection.FormFields.Item(1).Name
sChecka = sCheck & "a"
sCheckb = sCheck & "b"
bCheck = ActiveDocument.FormFields(sCheck).CheckBox.Value
'
' Unprotect document
ActiveDocument.Unprotect
'
' Set value for dependent checkboxes and reprotect document
ActiveDocument.FormFields(sChecka).CheckBox.Value = bCheck
ActiveDocument.FormFields(sCheckb).CheckBox.Value = bCheck
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End Sub