Importing External Module

How would I go about importing an external module?

Say for example in a project if I wanted a command button to be pressed that would then load example.bas and execute the code in the example.bas module as part of the command_click sub routine?

Keeping in mind that the example.bas in not a module that is part of the project it is one that is a standalone module within a different directory.

Comments

  • i am not exactly sure what you are trying to do.

    What it sounds like you are trying to do is load a module (*.bas) and execute code from it while the program is running. If this is the case this can not be done (at least to my knowledge). What i would recommend doing is going and clicking on add module then click existing then add that module into your program and then in the command buttons click event use a call statement so that you can use that in the program. Another way of doing this would be to make it a *.dll (dynamic link library) and just refrenecing it in your program (note this is might sound easy but its really not unless you know what you are doing).


    : How would I go about importing an external module?
    :
    : Say for example in a project if I wanted a command button to be pressed that would then load example.bas and execute the code in the example.bas module as part of the command_click sub routine?
    :
    : Keeping in mind that the example.bas in not a module that is part of the project it is one that is a standalone module within a different directory.
    :
    :

  • Thanks for the help. Thats exactly what I was trying to do.
    -=JuicE=-
  • HI hows things,
    Im surprised I can actually maybe help with something so early on in my development as a VB guy.

    Dave previously mentioned using DLLS.

    The Active X DLL project option is a good way to go for the "Module" you say you would like to "Import"

    If you create a project group consisting of Active X DLLs, you can reference parts of each DLL and control scope within each DLL as you would in any of the other commonly used application types.
    This enables you to use functions/procedures/declarations from outside your application.

    Dave if you read this, does that sound on the right track to you?

    Cheers BirkoffWannabe.
  • yes that sounds right you just have to make sure that you have the refrence set up (project refrences) or if you are using a api (application programmers interace) that you know how to use it.

    : HI hows things,
    : Im surprised I can actually maybe help with something so early on in my development as a VB guy.
    :
    : Dave previously mentioned using DLLS.
    :
    : The Active X DLL project option is a good way to go for the "Module" you say you would like to "Import"
    :
    : If you create a project group consisting of Active X DLLs, you can reference parts of each DLL and control scope within each DLL as you would in any of the other commonly used application types.
    : This enables you to use functions/procedures/declarations from outside your application.
    :
    : Dave if you read this, does that sound on the right track to you?
    :
    : Cheers BirkoffWannabe.
    :

  • Ahh yes, thanks DaveR.
    One of my first de bug style jobs involved finding out that THAT was one of the problems in the development environment.

    If you have a project group or if you have an application of course thats using any external objects, they all need to be referenced in the Project References Dialogue box (or project components dialogue box as may be required) .

    Also I discovered that sometimes, in a project group, even though you may have correctly assigned the "Start up" Project, there may be a required sequence for compiling each of these projects in succession.
    One of the things that brings about that neccessity is the progressive declarations that need to be cross referenced as each Application starts. ie There may be an "invalid object" vb error message box if the project starting cant find what it needs yet because the appropriate corresponding project is yet to be compiled.

    I know this discussion isnt a question as such and its Way back to basics for many people here, But Hey thats where i am ;o) I also hope that if anyone recognises some error in my thoughts, they might be kind enough to impart some of their wisdom experience in my direction.
    ps: Im currently studying for my MCP towards MCSD.

    Thanks again folks and hopefully I might have been some help too JuicE





    : yes that sounds right you just have to make sure that you have the refrence set up (project refrences) or if you are using a api (application programmers interace) that you know how to use it.
    :
    : : HI hows things,
    : : Im surprised I can actually maybe help with something so early on in my development as a VB guy.
    : :
    : : Dave previously mentioned using DLLS.
    : :
    : : The Active X DLL project option is a good way to go for the "Module" you say you would like to "Import"
    : :
    : : If you create a project group consisting of Active X DLLs, you can reference parts of each DLL and control scope within each DLL as you would in any of the other commonly used application types.
    : : This enables you to use functions/procedures/declarations from outside your application.
    : :
    : : Dave if you read this, does that sound on the right track to you?
    : :
    : : Cheers BirkoffWannabe.
    : :
    :
    :

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories