API-Locking external references

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

Reply to
Loading thread data ...

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!


Reply to
Heikki Leivo

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.