Running a macro on entry in a checkbox

J

Jack_Feeman

What have I forgotten in getting this macro to run when a user clicks a
checkbox that has this macro indicated on the run on entry parameter of the
checkbox form field options box:
"Sub continue11()
'
' continue11 Macro
' Macro recorded 8/22/2005 by Jack Feeman
'
Selection.GoTo What:=wdGoToBookmark, Name:="Text11"
Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Collapse
End Sub
"
It runs fine if I put it in the Run on exit parameter but I need it to
"when" the continue checkbox is clicked. The macro takes the user to a text
form field (Text11) on a continuation page of the form when the appropriate
check box is clicked.

Thanks
 
J

Jean-Guy Marcil

Jack_Feeman was telling us:
Jack_Feeman nous racontait que :
What have I forgotten in getting this macro to run when a user clicks
a checkbox that has this macro indicated on the run on entry
parameter of the checkbox form field options box:
"Sub continue11()
'
' continue11 Macro
' Macro recorded 8/22/2005 by Jack Feeman
'
Selection.GoTo What:=wdGoToBookmark, Name:="Text11"
Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Collapse
End Sub
"
It runs fine if I put it in the Run on exit parameter but I need it to
"when" the continue checkbox is clicked. The macro takes the user to
a text form field (Text11) on a continuation page of the form when
the appropriate check box is clicked.

Your code works as posted on my machine (Word 2003).
So, not sure what to tell you...

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
J

Jack_Feeman

Thanks Jean-Guy for the fast response.
I am using Word2k3 also on an XP Pro box. But maybe I will try running it on
a different machine. I thought maybe there was something I needed to add the
Checkbox entry in VBA where it reads:
"Private Sub CheckBox1_Click()

End Sub"
Anyway thanks for the response.
Jack
 
J

Jean-Guy Marcil

Jack_Feeman was telling us:
Jack_Feeman nous racontait que :
Thanks Jean-Guy for the fast response.
I am using Word2k3 also on an XP Pro box. But maybe I will try
running it on a different machine. I thought maybe there was
something I needed to add the Checkbox entry in VBA where it reads:
"Private Sub CheckBox1_Click()

End Sub"

Before I reply any further, can you clarify what it is you are doing.

In your original post you posted a macro called
Sub continue11()
From this, I assumed that you were writing about formfield checkboxes.

Now, you are writing about
Private Sub CheckBox1_Click()
which is either an ActiveX control (from the "Control toolbox") or on a
userform.

Which is it?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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