Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2010 Word user form with checkbox

Status
Not open for further replies.

Eprice

Technical User
May 6, 2003
209
US
Hi,
We are converting our Word 2002 templates to Word 2010. In the old Word our code for the userform initialize event we used this code and it worked fine but does not work in 2010.

If ActiveDocument.FormFields("bmDaily")= True Then
Me.ckDaily.Value = True
Else
Me.ckDaily.Value = False
End If
Does anybody know what the new syntax for Word 2010 is?
Lisa
 

Check boxes on a UserForm in 2010 have Value of True/False, so I would investigate the ActiveDocument.FormFields("bmDaily")

What is this FormField("bmDaily")?

Have fun.

---- Andy
 
FormField("bmDaily") is a checkbox field on the actual document. ckDaily is a checkbox on the userform.

When the user opens the template the 'user form' opens and they fill in information. The 'OK' button on the user form will check the checkbox on the document if they checked the checkbox on the user form. That all still works.

The initialize event is in case they want to reopen the form and make changes. It (the code) does not show the ckeckbox on the userform being checked anymore when the checkbox on the document is checked, like it used to.
Lisa
 
FYI,
I figured out my own problem. The code should be written like this now.
If ActiveDocument.FormFields("bmDaily").Result = 1 Then
Me.ckDaily.Value = True
Else
Me.ckDaily.Value = False
End If
Thanks anyway.
Lisa
 

I would try:
Code:
[blue]Debug.Print ActiveDocument.FormFields("bmDaily")[/blue]

If ActiveDocument.FormFields("bmDaily")= True Then
    Me.ckDaily.Value = True
Else
    Me.ckDaily.Value = False
End If
And see what the [blue]BLUE[/blue] line of code gives you in the Immediate Window in VBA

I can see 'ck' stands for CheckBox, what about 'bm' ?

Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top