I’m using VB to create loads of objects that I’ve got in an Excel spreadsheet. Some of the objects are detail objects and I’m trying to use the
Obj.AssociatedDimension= MyObject (MyClass)
property to nominate the Dimension that I want the object to be linked to.
I don’t get any errors. The detail object is created in the correct class but my link to the dimension is not there. I think the way I am referring to the Dimension Object is incorrect. I’m simply supplying it with a string with the object name and the class name in brackets.
Can anyone tell me how to correctly refer to the Class/Object I’m interested in.
How are MyObject and MyClass defined? In any case, the right hand side needs to be a reference to an Object object (confusing, sorry ). In the same way that you Set Obj = the detail object, if you Set Obj2 = the dimension object, then your code would be:
Set Cls = Univ.Classes.FindClass('ClassName')
Set ObjD = Cls.Objects('ObjectName')
Obj.AssociatedDimension = ObjD
But nothing happens. I’ve tried it with SET as well. The only thing I can think of is that ObjD has just been created. Maybe I need to save the universe before doing this step?
Is that the exact syntax? I’m quite certain the apostrophes need to be quote marks if those are character strings, and need to be removed if those are VBA variables. Do you get any errors (compile, runtime)?
If the ObjD object does indeed exist first (I assume you get no errors and the MsgBox diagnostic confirms), I’m afraid I’m out of ideas. I don’t have time to test it myself at the moment, but maybe if you let us know the version you’re using, someone else may help confirm … could possibly be a bug.