I've got a custom VBA function that works perfectly when called from a parameter in my part.
However, when in the context of my assembly, there is no error, but the function no longer runs, and the parameter text is red.
Apparently, the function is no longer in context?
Any ideas here about how to get around this?
I've heard of external rules, but have never implemented one.
Is there a way to declare my function and keep it in context regardless?
Thank you,
Evan
Public Function BumpHeight(dblHeight As Double, dblMember As Double) As Double Dim X As Integer X = 2 If dblHeight > dblMember * 2 Then BumpHeight = dblHeight Else BumpHeight = dblMember * X End If BumpHeight = BumpHeight / 2.54 End Function
Here is the Parameter:
VBA:BumpHeight(ValanceBackBumpoutHeight;ValanceMemberSize) * 1 in
Thank you for any help!
-------------------------
Update: (problem better defined)
What seems to be happening is that once I insert the part into an assembly, it creates a new blank copy of the parts' modules in VBA and the functions no longer work.
If I go to the VBA editor,
There are now two copies of my part listed in the browser tree, but the new one is blank.
If I paste in my function to the new one, it will work until I return to the parent assembly.
Next time I come back to the part, it will have a new blank set of modules.
This appears to continue indefinitely...
Please see the attached screenshot.
At this point there are only 2 copies of the DocumentProject. The original still contains my functions, but the new one is blank.
Please help - I need these functions to work in order to build my model.
Thank you,
Evan
Hi Evan,
Are you sure the 2nd DocumentProject is not the one associated with the assembly?
VBA Functions are pretty limitted, you won't be able to use in the context of the assembly a function defined in the part.
Achieving this with iLogic should be pretty straightforward, you may want to consider that approach instead.
Regards,
Philippe.