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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object Required Error

Status
Not open for further replies.

noHandlebars

Technical User
Jun 25, 2008
46
US
I'm getting an *Object Required* error for the following code:

Dim cOne, cTwo, cThree, cFour, cFiveA, cFiveB, cSix, cSeven, cEight, cNine As Boolean

Set cOne = ActiveDocument.FormFields("ccheck1").CheckBox
Set cTwo = ActiveDocument.FormFields("ccheck2").CheckBox
Set cThree = ActiveDocument.FormFields("ccheck3").CheckBox
Set cFour = ActiveDocument.FormFields("ccheck4").CheckBox
Set cFiveA = ActiveDocument.FormFields("ccheck5").CheckBox
Set cFiveB = ActiveDocument.FormFields("ccheck6").CheckBox
Set cSix = ActiveDocument.FormFields("ccheck7").CheckBox
Set cSeven = ActiveDocument.FormFields("ccheck8").CheckBox
Set cEight = ActiveDocument.FormFields("ccheck9").CheckBox
Set cNine = ActiveDocument.FormFields("ccheck10").CheckBox
'this last variable "cNine" is where i get the error

I'm not sure what's wrong because the all the other variables work and they are all the same format. Any suggestions?

 




Hi,

You may THINK that you have declared all your variables as Boolean. NOT!

Only the LAST declaration is Boolean. All the others are Variant, by default...
Code:
Dim cOne, cTwo, cThree, cFour, cFiveA, cFiveB, cSix, cSeven, cEight, [b]cNine As Boolean[/b]

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
And, if you did think they were all Boolean - or if you made them all Boolean - the first statement would give the 'Object required' error. Do you want your variables as checkboxes or as checkbox values? The Set statement sets a variable to an object (or an object pointer).

Enjoy,
Tony

------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

I'm working (slowly) on my own website
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top