1 Reply Latest reply on Mar 31, 2015 10:12 PM by Earl Navarro

    addreferencepath Problem

    Earl Navarro



      i have this sub running inside MS WORD, everytime it reaches this line


        'addCustRefs.AddReferencesPath objFile.ID, ppofileidarray"


      MSWORD STOPS responding...


      Basically im trying to paste as reference using "addreferencepath"



      my code below


      Sub ADD_REF()
      ' Stop
      'Set the initial directory in the Select File dialog
      'Application.Visible = False
      Dim batchChanger As IEdmBatchChangeState3
      Dim addCustRefs As IEdmAddCustomRefs2
      Dim ppofileidarray(0 To 20) As String
      Dim lngcount As Integer
      Dim element As Variant
        Set objFile = objVault.GetFileFromPath(STRFILENAME, parentFolder)
      ' Stop
         Set batchChanger = objVault.CreateUtility(EdmUtility.EdmUtil_BatchChangeState)
         Set addCustRefs = objVault.CreateUtility(EdmUtility.EdmUtil_AddCustomRefs)
      With Application.filedialog(msoFileDialogOpen)
              .AllowMultiSelect = True
              ' Display paths of each file selected
              For lngcount = 1 To .SelectedItems.Count
                    'MsgBox .SelectedItems(lngcount)
              Dim REF_folder As IEdmFolder7
          Set REF_folder = objVault.GetFolderFromPath(.SelectedItems(lngcount))
          Set REF_File = objVault.GetFileFromPath(.SelectedItems(lngcount), REF_folder)
          ppofileidarray(lngcount) = .SelectedItems(lngcount)
          batchChanger.AddFile REF_File.ID, REF_folder.ID
              batchChanger.Comment = "ECO IN PROCESS"
           retVal = batchChanger.CreateTree("Process ECO-Initial Release")
              batchChanger.ChangeState 0
                     Next lngcount
          End With

              'Paste as ref
              addCustRefs.AddReferencesPath objFile.ID, ppofileidarray<<<<<<<<Problematic code?
              addCustRefs.CreateTree (CInt(EdmCreateReferenceFlags.Ecrf_Nothing))
              retCode = addCustRefs.CreateReferences()

      End Sub


      Please help...