4 Replies Latest reply on Feb 15, 2012 1:38 PM by Wayne Matus

    Can't check-in after adding reference - API

    Brian Dalton

      I'm trying to use a VBA macro to set a reference between two files and it works, but once the reference is created the macro fails when I try to check the referencing file back in.  This method worked in my test macro but fails when I include it in to a working spreadsheet file.  Here's the pertinent code.  The vaultMain object is already instantiated and logged in and the string variables have legitimate path/filename values.


      Error Checking in after reference.jpg


      I'm not sure if there's a conflict because of having both an iEdmFile8 reference and an iEdmEnumeratorCustomReference5 reference based on the same file... the former is needed to checkout/checkin the file and the latter is needed to add the reference.


      Any ideas?


      CORRECTION NOTE: The first annotation in the code image should read "FILE CHECKS OUT SUCCESSFULLY"


      Message was edited by: Brian Dalton

        • Re: Can't check-in after adding reference - API
          Wayne Matus

          I have not looked at your code close enough to see what is wrong, but if it is a conflict you could "Set object = Nothing" when you are finished with the object. That should eliminate the conflict if that is the problem.


          I should add, can you manually check in the file after the macro fails to do it. If you cannot, then kit is a permissions issue, not a code issue.

            • Re: Can't check-in after adding reference - API
              Brian Dalton

              I tried it that way as well, but it didn't help.  What had me confused is that I had used the same technique in a separate test macro (skeleton code) and it worked fine.  However...


              I went back to the test code and tried to run it on the file which was giving me trouble and found that it failed to check in there, too.


              Some further checking revealed that the drawing that was failing to check in (file not found error) after a reference had been added to it had a SW reference to a missing model (the view just showed an empty frame).  When I switched to a drawing that had no broken SW references the code worked fine - both my test code and in the working spreadsheet.


              So...  My guess is that the 'file not found' error didn't refer to the drawing I was checking in, but rather to the model it was referencing which did not exist.  I'm not sure why it would do that, or how I can check a drawing for broken references before trying to do a checkout/checkin, but at least I know my code is OK when the files themselves are not buggerred up...


              Thanks again, Wayne!