title: CATIA VBA check parameter existence
body: <p>I'm trying to check for the existence of specific parameters in a part and if it does not exist then I want to skip a small section of my code.
  This is my current code that works as desired:</p>
  
  <pre><code>Dim partDoc As PartDocument
  Set partDoc = CATIA.ActiveDocument
  
  Dim ParamV As Parameter
  Set ParamV = partDoc.Part.Parameters.Item("ParName")
  Dostuffwith ParamV
  </code></pre>
  
  <p>Now I want to add a check before executing the last 2 lines of code, it would become something like this:</p>
  
  <pre><code>Dim partDoc As PartDocument
  Set partDoc = CATIA.ActiveDocument
  
  Dim ParamV As Parameter
  
  If partDoc.Part.Parameters.Item("ParName") Exists 
  then
  Set ParamV = partDoc.Part.Parameters.Item("ParName")
  Dostuffwith ParamV
  End If
  </code></pre>
  
  <p>I tried using </p>
  
  <pre><code>On Error goto label1
  Set ParamV = partDoc.Part.Parameters.Item("ParName")
  Dostuffwith ParamV
  label1
  </code></pre>
  
  <p>But this is impossible because On Error needs to end with a Resume or Resume Next. I couldn't find a way to make it Resume after "Dostuffwith ParamV", it will always Resume at the line of code that prompted the error in the first place.</p>
  
  <p>I also tried</p>
  
  <pre><code>If not partDoc.Part.Parameters.Item("ParName") is nothing 
  Then
  Set ParamV = partDoc.Part.Parameters.Item("ParName")
  Dostuffwith ParamV
  End If
  </code></pre>
  
  <p>But this also gives an error because parameter ParName just doesn't exist.</p>
  
  <p>I don't know what else I can try, please help.</p>