Combo Box Code Error - Please Help!

D

dworst

I have a MS Word document form in which I have a combo box with the
values of Select, Assessment Period and Project. Upon the user
selecting a value I want rows of a table to hide or unhide. I've
assigned the below macro to the onExit of the Combo Box called
AssessmentType. When I run it I get this error message. Could someone
help me out with what is incorrect here?

Thanks so much.


Object doesn't support this property or method.

Public Sub AssessmentType()
If (ActiveDocument.ComboBox("AssessmentType").Result) = "Assessment
Period" Then
ActiveDocument.Unprotect
ActiveDocument.Tables(2).Rows(2).Range.Font.Hidden = True
ActiveDocument.Tables(2).Rows(3).Range.Font.Hidden = False

If (ActiveDcoument.ComboBox("AssessmentType").Result) = "Project" Then
ActiveDocument.Unprotect
ActiveDocument.Tables(2).Rows(2).Range.Font.Hidden = False
ActiveDocument.Tables(2).Rows(3).Range.Font.Hidden = True
Else
If (ActiveDocument.ComboBox("AssessmentType").Result) = "Select" Then
ActiveDocument.Unprotect
ActiveDocument.Tables(2).Rows(2).Range.Font.Hidden = True
ActiveDocument.Tables(2).Rows(3).Range.Font.Hidden = True
ActiveDocument.Protect wdAllowOnlyFormFields, NoReset
End If
End If
End If

End Sub
 
H

Helmut Weber

Hi,

though I'm no good at forms,
but IMHO, if talking about forms and forms only,
not activeX-stuff, there is no combobox object.
There are formfield objects of type wdFieldFormDropDown (83).

Sub TestDrop()
MsgBox ActiveDocument.FormFields(1).Name
MsgBox ActiveDocument.FormFields(1).Type
MsgBox ActiveDocument.FormFields(1).Result
' MsgBox ActiveDocument.ComboBox(1).Result ' no
End Sub


--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

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