title: Catia VBA Saving specific parts or products from a .stp file as .CATPart and/or .CATProduct
body: <p>I have an .stp file, exported with a different CAD-software, which I can open with CATIA.
  CATIA will then list the product/part tree as if it were a native CATIA .CATProduct.</p>
  
  <p>My goal is to automate opening such an .stp file with CATIA and saving all contained parts/products with a name that is extracted from one of the UserRefProperties in each of these parts/products.
  Therefore I want to create a macro with VBA which when completed will run in batch mode.</p>
  
  <p>My first problem arises when I try to save the parts/products in this .stp file, Catia's save function handles my file as desired and will save each part/product as a separate file.
  However, using VBA I can't seem to be able to save any of these parts/products since the .ExportData and .SaveAs methods only seem to work on .PartDocument or .ProductDocument objects instead of the objects which I've been trying to save:
  .Product objects.</p>
  
  <p>Example of what I'm trying to do:</p>
  
  <pre><code>Sub catmain()
  
  Dim oProdDoc As ProductDocument
  Set oProdDoc = CATIA.ActiveDocument
  
  Dim oRootProd As Product
  Set oRootProd = oProdDoc.Product
  
  Dim oInstances As Products
  Set oInstances = oRootProd.Products
  
  For k = 1 To oInstances.Count
  
  Dim oInst As Product
  Set oInst = oInstances.Item(k)
  
  oInst.ExportData "X:\path", ".CATPart"
  
  next
  
  end sub
  </code></pre>
  
  <p>If CATIA can save my .stp file's contents as desired, surely I can do the same with VBA, right?</p>
  
  <p>Any help would be greatly appreciated.</p>