Y
YvonneW
Question
I have created a number of checklists with visual basic code which enables
text to become unhidden when a checkbox is checked.
The document was created in Compatibility mode in Office 2007 and saved as
an Office 97-2003 document.
When clicking on a checkbox in Office 2003, Word crashes. This does not
consistently happen. One day it crashes, the next it is fine. The code is:
Private Sub ShowArea(ByRef aCheckBox As MSForms.CheckBox, ByVal sBookmark As
String)
Dim bProteced As Boolean
Dim iSection As Integer
bProtected = (ActiveDocument.ProtectionType <> wdNoProtection)
If bProtected Then ActiveDocument.Unprotect
ActiveDocument.Bookmarks.ShowHidden = True
ActiveWindow.View.ShowHiddenText = True
iSection =
ActiveDocument.Bookmarks(sBookmark).Range.Information(wdActiveEndSectionNumber)
ActiveWindow.View.ShowHiddenText = False
ActiveDocument.Bookmarks.ShowHidden = False
ActiveDocument.Sections.Item(iSection).Range.Font.Hidden = Not
aCheckBox.Value
If bProtected Then ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub
Private Sub CheckBox1_Click()
ShowArea CheckBox1, "_Commencement"
End Sub
I have created a number of checklists with visual basic code which enables
text to become unhidden when a checkbox is checked.
The document was created in Compatibility mode in Office 2007 and saved as
an Office 97-2003 document.
When clicking on a checkbox in Office 2003, Word crashes. This does not
consistently happen. One day it crashes, the next it is fine. The code is:
Private Sub ShowArea(ByRef aCheckBox As MSForms.CheckBox, ByVal sBookmark As
String)
Dim bProteced As Boolean
Dim iSection As Integer
bProtected = (ActiveDocument.ProtectionType <> wdNoProtection)
If bProtected Then ActiveDocument.Unprotect
ActiveDocument.Bookmarks.ShowHidden = True
ActiveWindow.View.ShowHiddenText = True
iSection =
ActiveDocument.Bookmarks(sBookmark).Range.Information(wdActiveEndSectionNumber)
ActiveWindow.View.ShowHiddenText = False
ActiveDocument.Bookmarks.ShowHidden = False
ActiveDocument.Sections.Item(iSection).Range.Font.Hidden = Not
aCheckBox.Value
If bProtected Then ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub
Private Sub CheckBox1_Click()
ShowArea CheckBox1, "_Commencement"
End Sub