First let me say I'm a word noob and I'm probably doing something really dumb here. I'm trying to add conditional drop down lists to a document. To be able to select a car make and then get a list of models. I named the lists MakeDD and ModelDD
Sub Dealerbos()
If ActiveDocument.FormFields("MakeDD").DropDown.Value = 0 Then
ActiveDocument.FormFields("ModelDD").DropDown.ListEntries.Clear
Exit Sub
End If
Select Case ActiveDocument.FormFields("MakeDD").Result
Case "Acura"
With ActiveDocument.FormFields("ModelDD").DropDown.ListEntries
.Clear
.Add "MDX"
.Add "RDX"
.Add "RL"
.Add "TL"
.Add "TSX"
.Add "ZDX"
End With
Code is not mine. Found a guide about doing this and modified the above code. It throws a runtime error 5941 on the first line.
If ActiveDocument.FormFields("MakeDD").DropDown.Value = 0 Then
Like it's not reading the MakeDD drop down box. What's the deal here?
[VBA]Sub Dealerbos()
Dim oLEs As ListEntries
Set oLEs = ActiveDocument.FormFields("ModelDD").DropDown.ListEntries
Select Case ActiveDocument.FormFields("MakeDD").Result
Case "Acura"
With oLEs
.Clear
.Add "MDX"
.Add "RDX"
.Add "RL"
.Add "TL"
.Add "TSX"
.Add "ZDX"
End With
Case "Accord"
Nevermind, silly syntax error on my part. Well I'm back to runtime error 5941. On:
Set oLEs = ActiveDocument.FormFields("ModelDD").DropDown.ListEntries
Same line as with the previous code. What's the deal?
Also I'm not sure about this option to run on exit. I thought it was removed from office 2007 and on. As there is no properties option when right clicking on a form field.
Again, sneaking suspicion I'm doing something terribly obvious here. I opened properties on the drop down and set the title and tag to MakeDD and ModelDD on the involved drop downs. I see no reference to the default bookmarks. I think I'm missing something here. I've also set bookmarks under insert, but they don't seem to have the same meaning as the examples on your site. There are no generic DropDown1, Text1 bookmarks prefilled in there.