Reply

Creating a Revision Manager Object from VB

[ Edited ]

Hi - I got the code below by reading some of Jason's conference materials (a ppt presentation). Trying to get information on the children of an assembly (eventually adding to a database).

 

I'm getting the error (ActiveX component can't create object) - which I think is due to the way that I'm referencing the component when it's created. Can someone help me with the syntax - or point me to documentation on how to call and use these components?

 

Thanks.

 

Public Sub PrintGetLinkedfiles()

'Returns in the debug window all children of an assembly.Dim objRM As RevisionManager.ApplicationDim objDocument As RevisionManager.DocumentDim objChild As RevisionManager.DocumentDim objLinks As RevisionManager.LinkedDocumentsDim i As Integer

objRM = CreateObject("RevisionManager.Application")objDocument = objRM.Open("C:\SEParts\00-BAGHOUSE.asm")Debug.Print objDocument.FullName & vbCrLf & "|"

For i = 1 To objLinks.Count    objChild = objLinks.Item(i)    Debug.Print "-- " & objChild.FullName & vbCrLfNext

Debug.Print "-----------------------------------------"Debug.Print "Total Number of Parts: " & CStr(i)

End Sub 

***Sorry can't format the code.  Lost the code button?

 

Posted by: Chris Bloom
Post date: 5/26/2011 5:39:48 AM

4 REPLIES

RE: Creating a Revision Manager Object from VB

[ Edited ]

Chris,

 

What version of VB are you using? If VB6, you are missing Set statements when you assign your objects. i.e. Set objRM = ...

 

Posted by: Jason Newell
Post date: 5/26/2011 3:55:58 PM

RE: Creating a Revision Manager Object from VB

[ Edited ]

I'm not sure which version I'm using - but my editor is VB2010 express.

When I try to add the "Set objRM = " the editor removes the "SET" automatically.

Sorry if this is too elementary - I've literally spent a couple days on this and it's getting quite frustrating.  I can get other libraries to work fine, but this one (the one I really need) just won't work.

FYI, I am using Windows 7 x64...but I have taken the .tlb file from both the 64 bit and 32 bit installations of SE and tried registering them (seems like the same file?)

Thanks.

 

Posted by: Chris Bloom
Post date: 5/31/2011 4:08:58 AM

RE: Creating a Revision Manager Object from VB

[ Edited ]

 

Chris,

 

in your code above the variable objLinks is undefined. You just declared it to be of type RevisionManager.LinkedFiles.

Before using the variable objLinks you have to assign to it a correct reference:

 

Insert just before your next loop

objLinks = objDocument.LinkedFiles

 

Now you get all linked files of level 1 of your loaded assembly. To traverse the whole assembly structure you have to do a little more by calling your code recursively for all found linked documents of type assembly.

 

 

 

 

Posted by: Wolfgang Kunert
Post date: 5/31/2011 5:06:11 AM

RE: Creating a Revision Manager Object from VB

[ Edited ]

Thanks for the help.

 

I think the problem I was having ended up being that we are still using v20 and I'm on Windows 7 x64. I uninstalled and went with ST3 x64 and my (now updated) code works well.

 

Thanks again!

 

Posted by: Chris Bloom
Post date: 5/31/2011 6:22:26 AM