A
Angie M.
Hello, I'm using Word '03. I have a macro that opens a form where the users
have a choice of style options (which are macros). My problem is, the Cancel
button (btnCancel) does not work. It successfully hides the form, but if a
user clicks an option button before hitting cancel, it still carries out the
macro. I would like to be able to cancel the whole thing if I hit cancel.
Here is the macro that is stored in the global template:
Sub CallNumForm()
With frmNumber
.Show
If frmNumber.btnCancel = True Then
Exit Sub
End If
End With
Unload frmNumber
Set frmNumber = Nothing
End Sub
BEHIND THE FORM I HAVE THE FOLLOWING CODE:
Public Sub UserForm_Initialize()
With frmNumber
..optNone = True
..optNone.SetFocus
End With
End Sub
Sub btnOK_Click()
btnOKclicked = True
Me.Hide
End Sub
Sub btnCancel_Click()
btnOKclicked = False
Me.Hide
End Sub
Sub opt1_click()
Call NumOut1
End Sub
Sub opt2_Click()
Call NumOut2
End Sub
Sub NumOut1()
' ActiveDocument.CopyStylesFromTemplate Template:= _
"c:\Docs\Demo\Style Sheets\#1 Style Sheet.dot"
CommandBars("Paragraph Numbering").Visible = True
End Sub
Sub NumOut2()
ActiveDocument.CopyStylesFromTemplate Template:= _
"c:\Docs\Demo\Style Sheets\#2 Style Sheet.dot"
CommandBars("Paragraph Numbering").Visible = True
End Sub
ANY SUGGESTIONS WOULD BE APPRECIATED!
have a choice of style options (which are macros). My problem is, the Cancel
button (btnCancel) does not work. It successfully hides the form, but if a
user clicks an option button before hitting cancel, it still carries out the
macro. I would like to be able to cancel the whole thing if I hit cancel.
Here is the macro that is stored in the global template:
Sub CallNumForm()
With frmNumber
.Show
If frmNumber.btnCancel = True Then
Exit Sub
End If
End With
Unload frmNumber
Set frmNumber = Nothing
End Sub
BEHIND THE FORM I HAVE THE FOLLOWING CODE:
Public Sub UserForm_Initialize()
With frmNumber
..optNone = True
..optNone.SetFocus
End With
End Sub
Sub btnOK_Click()
btnOKclicked = True
Me.Hide
End Sub
Sub btnCancel_Click()
btnOKclicked = False
Me.Hide
End Sub
Sub opt1_click()
Call NumOut1
End Sub
Sub opt2_Click()
Call NumOut2
End Sub
Sub NumOut1()
' ActiveDocument.CopyStylesFromTemplate Template:= _
"c:\Docs\Demo\Style Sheets\#1 Style Sheet.dot"
CommandBars("Paragraph Numbering").Visible = True
End Sub
Sub NumOut2()
ActiveDocument.CopyStylesFromTemplate Template:= _
"c:\Docs\Demo\Style Sheets\#2 Style Sheet.dot"
CommandBars("Paragraph Numbering").Visible = True
End Sub
ANY SUGGESTIONS WOULD BE APPRECIATED!