title: VBA if combobox exists then
body: <p>I modified a Word document, adding 4 ComboBoxes, each with some dropdown choices.  It works fine, except when a user deletes a section of the document that contains one of the ComboBoxes.  If they do that, when they re-open the doc, they get "Compile error: Method or data member not found"</p>
  
  <p>Is there a way I can add code that will check to see if the ComboBox exists on opening the document and either perform the code or ignore it?  I've tried using "On Error Resume Next" to no avail.</p>
  
  <p>Here is a snippet of the code:</p>
  
  <pre><code>Private Sub Document_Open()
  On Error Resume Next
  
      ComboBox2.List = Array("Choose One", "SSN", "Employee ID")
          If Me.ComboBox2.Value &lt;&gt; "SSN" And Me.ComboBox2.Value &lt;&gt; "Employee ID" Then
              Me.ComboBox2.Text = Me.ComboBox2.List(0)
          End If
          If ComboBox2.Value = "Choose One" Then
              TextBox3.Value = ""
          ElseIf ComboBox2.Value = "SSN" Then
              TextBox3.Value = ""
          ElseIf ComboBox2.Value = "Employee ID" Then
              TextBox3.Value = "Employee ID must be unique by employee and " &amp; _
                               "all numeric with a max of 9 digits."
          End If
  Error = 0
  
  End Sub
  </code></pre>
  
  <p>If the user removes ComboBox2, then re-opens the doc - it bombs out and gets that error.  </p>
  
  <p>Thank you!</p>