Hi Jerome, thank you for the response. We will discuss the proposed solution. But given your answer that the name is changed to '(unitialised)' when the data type is changed, i've also tested another workaround: 'ExpressionType
if exptype.count = 1 then
aDuplicateAttribute.SetProp "Local Name", iAttr.GetProp("Local Name")' Reset the name after the attributes was connected to the TypeClass. This also works. So we will see what's the best solution for now. Kind regards, Jeroen.
... View more
***UPDATE*** ***UPDATE*** ***UPDATE*** The problem seems not to be with the function GetObjectFromIDn but with the MegaObjectType Diagram when the macro is called from within the VB.NET project: For testing purposes I've written a simple macro that makes collections of 2 types of MegaObjectTypes, macros and diagrams: myRoot = GetRoot oObjects = myRoot.Getcollection("Macro") msgbox oObjects.Count & " Macros" oObjects = myRoot.Getcollection("Diagram") msgbox oObjects.Count & " diagrams" When I launch the macro from within MEGA I get the correct result for macros (6474) AND diagrams (. When I call the macro from VB.NET I get the correct result for macros (6474), but I get no diagrams. If go further and try to count other object, I try queries (2 times succesfull), next I try Database (only lucky within MEGA, and not via VB.NET) It seems that the currentenvironment is not properly loaded when I perform my GetRoot in the called macro. All objects that are shared in different repositories (query, macro, ...) can be selected, all objects that belong to the currentrepository can not be selected... I'm calling my macro from VB.NET using the following code (written by an external consultant of MEGA who helped us with our migration from MEGA 6.1 towards MEGA 2009) oMacro = MyRoot.GetSelection("Select [Macro] where [_hexaidabs] =" + DQ + sIdMacro + DQ)
If oMacro.Count = 1 Then
aMacro = oMacro(1)
pMacro = MyRoot.CurrentEnvironment.GetMacro(aMacro.GetProp("name"))
oResult = pMacro.GetType().InvokeMember(sMacroFunction, BindingFlags.InvokeMethod, defaultBinder, pMacro, Nothing) Where sMacroFunction is the function within the macro that serves as starting point.
... View more