E
EKH
I’m pretty new to this, but I’ve created a .docm template with some
automation in 2007. The template contains activeX checkboxes and code for
click events. All works fine in the template but not in documents created
from the template. The template is saved to a trusted location. The other
strange thing is that the code works for a single click event regardless of
which checkbox is clicked and then stops running. I’m also using combo boxes
in the template with the same problem. The list items populate in the
template, but not in docs based on the template.
I’ve included the checkbox code from the template. Any help will be greatly
appreciated.
Public Sub OptGenExemptHide_Click()
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
With ActiveDocument
If ActiveDocument.Bookmarks.Exists("generalexemptions") = True Then
Msg = "This action will remove the General Exemptions checklist and changes
" & _
"made to it. Click OK to continue. Click Cancel to return to the
checklist."
Style = vbOKCancel + vbDefaultButton1
Title = "Remove Checklist"
Response = MsgBox(Msg, Style, Title)
If Response = vbOK Then
ActiveDocument.Bookmarks("generalexemptions").Select
Selection.Delete
OptGenExemptHide.Value = False
End If
Else
MsgBox "This checklist cannot be found."
OptGenExemptHide.Value = False
End If
End With
End Sub
Public Sub OptGenExemptView_Click()
With ActiveDocument
Selection.Move wdParagraph
'Selection.TypeParagraph
Selection.TypeText "exemption "
Selection.Range.InsertAutoText
'Selection.GoTo What:=wdGoToPage, Count:=2
End With
End Sub
Public Sub OptIdentHide1_Click()
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
If ActiveDocument.Bookmarks.Exists("identification") = True Then
Msg = "This action will remove the General Exemptions checklist and changes
" & _
"made to it. Click OK to continue. Click Cancel to return to the
checklist."
Style = vbOKCancel + vbDefaultButton1
Title = "Remove Checklist"
Response = MsgBox(Msg, Style, Title)
If Response = vbOK Then
ActiveDocument.Bookmarks("identification").Select
Selection.Delete
OptIdentHide1.Value = False
End If
Else
MsgBox "This checklist cannot be found."
OptIdentHide1.Value = False
End If
End Sub
automation in 2007. The template contains activeX checkboxes and code for
click events. All works fine in the template but not in documents created
from the template. The template is saved to a trusted location. The other
strange thing is that the code works for a single click event regardless of
which checkbox is clicked and then stops running. I’m also using combo boxes
in the template with the same problem. The list items populate in the
template, but not in docs based on the template.
I’ve included the checkbox code from the template. Any help will be greatly
appreciated.
Public Sub OptGenExemptHide_Click()
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
With ActiveDocument
If ActiveDocument.Bookmarks.Exists("generalexemptions") = True Then
Msg = "This action will remove the General Exemptions checklist and changes
" & _
"made to it. Click OK to continue. Click Cancel to return to the
checklist."
Style = vbOKCancel + vbDefaultButton1
Title = "Remove Checklist"
Response = MsgBox(Msg, Style, Title)
If Response = vbOK Then
ActiveDocument.Bookmarks("generalexemptions").Select
Selection.Delete
OptGenExemptHide.Value = False
End If
Else
MsgBox "This checklist cannot be found."
OptGenExemptHide.Value = False
End If
End With
End Sub
Public Sub OptGenExemptView_Click()
With ActiveDocument
Selection.Move wdParagraph
'Selection.TypeParagraph
Selection.TypeText "exemption "
Selection.Range.InsertAutoText
'Selection.GoTo What:=wdGoToPage, Count:=2
End With
End Sub
Public Sub OptIdentHide1_Click()
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
If ActiveDocument.Bookmarks.Exists("identification") = True Then
Msg = "This action will remove the General Exemptions checklist and changes
" & _
"made to it. Click OK to continue. Click Cancel to return to the
checklist."
Style = vbOKCancel + vbDefaultButton1
Title = "Remove Checklist"
Response = MsgBox(Msg, Style, Title)
If Response = vbOK Then
ActiveDocument.Bookmarks("identification").Select
Selection.Delete
OptIdentHide1.Value = False
End If
Else
MsgBox "This checklist cannot be found."
OptIdentHide1.Value = False
End If
End Sub