title: Sublevel part publications in CATIA
body: <p>I'm working on a project and I've been making headway and have ran into a problem in which I need help. I am attempting to publish user defined properties for parts at various levels. I am able to target the area but every time I attempt to create a reference it fails. Also, CATIA says that these elements are not publishable. I am able to publish when a part is in top level, what changes? </p>
  
  <p>Below is my code that targets and should make the publications.</p>
  
  <pre><code>Sub Sublevel_Part_Publication()
  
  'This is a work in progress sub
  
  For i = 1 To CATIA.Documents.Count
      'MsgBox i
      If CATIA.Documents.Item(i).Name = CATIA.ActiveDocument.Selection.Item(1).LeafProduct.ReferenceProduct.Name &amp; ".CATPart" Then
          Set Active_Name_Input = CATIA.Documents.Item(i).GetItem(1)
      End If
  Next
  
  
  Dim product1
  Set product1 = Active_Name_Input
  
  Dim PARAMS As Parameters
  Set PARAMS = product1.Parameters
  
  Dim RELATIONS As RELATIONS
  Set RELATIONS = product1.RELATIONS
  
  Dim PUBS As Publications
  Set PUBS = product1.Publications
  
  Set PARAM_MANUF = PARAMS.CreateString("MANUFACTURER/SOURCE", "")  
  
  
  '----- CREATE RELATIONS (FORMULAS) -----
  Set FORMULA_MANUF = RELATIONS.CreateFormula("MANUF", "", PARAM_MANUF, "`Properties\MANUFACTURER/SOURCE` ")   '"`" &amp; Active_Name_Input.Name &amp; "\Properties\MANUFACTURER/SOURCE` "
  
  
  '----- CREATE PUBLICATIONS -----
  Set REF_MANUF = product1.CreateReferenceFromName("MANUFACTURER/SOURCE")
  
  
  Set PUB_MANUF = PUBS.Add("MANUFACTURER/SOURCE")
  
  
  PUBS.SetDirect "MANUFACTURER/SOURCE", REF_MANUF
  
  
  
  End Sub
  </code></pre>
  
  <p>I attempted to do the direct route for publications and that continuously failed. Doing the parameters and formulas is a work around that works.</p>