Activate a VBProject

Discussion in 'AutoCAD' started by ClementZheng, Jan 26, 2005.

  1. ClementZheng

    ClementZheng Guest

    I know VBE.ActiveVBProject is a read-only property.
    In command window, by entering "VBASTMT" and "Msgbox VBE.ActiveVBProject.Name", I always get the name of latest-loaded project.
    Is it possible to activate one of the loaded projects to become the ActiveVBProject programmatically?
     
    ClementZheng, Jan 26, 2005
    #1
  2. ClementZheng

    VBA Guest

    Why would you want or need to do this?

    VBE.ActiveVBProject.Name", I always get the name of latest-loaded project.
    ActiveVBProject programmatically?
     
    VBA, Jan 26, 2005
    #2
  3. ClementZheng

    ClementZheng Guest

    Well, I have declared some public functions in a module.
    Such as :
    Public Function addAtoB(Byval intA As Integer, Byval intB As Integer) As Integer
    addAtoB=intA+intB
    End Function

    If the project with that function is the ActiveVBProject, I can use the function from VBASTMT and it works.
    Such as:
    Msgbox AddAtoB(2004,2005)

    But if I load another project later, a error message will show :
    "Syntax Error".

    Any suggestion?
     
    ClementZheng, Jan 27, 2005
    #3
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.