API-Locking external references

Discussion in 'SolidWorks' started by Sam, Jul 27, 2006.

  1. Sam

    Sam Guest

    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.


    <snip>
    Dim SetSuccess As Boolean
    SetSuccess = Modeldoc.LockAllExternalReferences 'lock all external
    references
    <snip>
     
    Sam, Jul 27, 2006
    #1
  2. Sam

    Heikki Leivo Guest

    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-
     
    Heikki Leivo, Jul 27, 2006
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.