MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Question on defaulting name from drop down list based on checkbox

  Asked By: Lucina    Date: Jan 13    Category: MS Office    Views: 1731

I'm trying to do something relatively simple, but I'm still a newbie in
VBA, so I'm getting an odd error. This is my first post to this group.

My logic is this. If checkbox 'abc' is checked, then default a value
from a downdown list in a userform to a certain name, like "John Doe".

here's my short code:

Sub Exp84CheckBox()

'declare a variable as boolean, since checkboxes are yes/no,
Dim blnExp84Value As Boolean

'set the value of the variable to the value of the master
blnExp84Value =

'if the master variable value is true (checked)
If blnExp84Value = True Then
ActiveDocument.FormFields("Approver1").DropDown.Value =
"John Doe"
End If

End Sub


However, I get an error that says:
"Run-time error '13':
Type mismatch

Can anyone help?



3 Answers Found

Answer #1    Answered By: Chau Tran     Answered On: Jan 13

What line does the type  mismatch occur??????

Answer #2    Answered By: Viheke Fischer     Answered On: Jan 13

Further questions

Are you using Excel vba?

Word uses ActiveDocument. Excel uses Active workbook or Active sheet.

Try clicking Debug/Compile and see if your code  is basically valid.

Answer #3    Answered By: Jeanette Greene     Answered On: Jan 13

I'm using Word 2003. I just went to the visual basic editor to try to
do this. I tried the debug thing, but it's not really doing much to
fix it.

I copied the code  in, do you see anything wrong with it?