API-Locking external references

Jul 27, 2006 1 Replies

I am trying to add some code to my program that will lock all the external references for the active doc but I keep receiving an error stating "Expected function or variable".



I can get it to work if I comment out the SetSuccess variable and just use Modeldoc.LockAllExternalReferences, which is what I will probably do for now but I was hoping someone could tell me why this is not working correctly.


Dim SetSuccess As Boolean SetSuccess = Modeldoc.LockAllExternalReferences 'lock all external references


Hello Sam,

The method you are using is documented in the SolidWorks API Help(tm) as following:

Syntax (OLE Automation) void ModelDoc2.LockAllExternalReferences ( ) Void means that the method does not return a value, eg. it is a "sub". So you cannot assign it to a variable, as you have tried in your example. "Expected function or variable" means literally, that assigning a value to a variable requires a function call or another variable; calling a sub is not a function call.

Hope this helps!

-h-

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required