Calling up outside functions?

Calling up outside functions?

Anonymous
Not applicable
282 Views
6 Replies
Message 1 of 7

Calling up outside functions?

Anonymous
Not applicable
I am currently learning VB other than LISP, and in LISP I have a file called "mysubr.lsp" which has all the subroutines that I use in my other LISP files, rather than retyping the code again. (ie 'dtr' is a function to change from degrees to radians and rather than retyping all the code I type (dtr 90)...this is just a small example of some of the more complicated subroutines I have.) My question is...is there a way in VB to write all my subroutines in one file and call up each routine rather than copying or retyping the code in every new project?
0 Likes
283 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
Hi Gary,

If no-one comes up with anything better, what I did was clipboarded the code
from lisp into VBA and then used search and replace for such things as

"(Defun " to "Sub"

I needed to do a fair bit of typing, but it was quicker than starting from
scratch.

You need to ignore the red lines till late in the exercise.

--




Laurie Comerford
CADApps
www.cadapps.com.au


"GARYNTX" wrote in message
news:f0aa239.-1@WebX.maYIadrTaRb...
> I am currently learning VB other than LISP, and in LISP I have a file
called "mysubr.lsp" which has all the subroutines that I use in my other
LISP files, rather than retyping the code again. (ie 'dtr' is a function to
change from degrees to radians and rather than retyping all the code I type
(dtr 90)...this is just a small example of some of the more complicated
subroutines I have.) My question is...is there a way in VB to write all my
subroutines in one file and call up each routine rather than copying or
retyping the code in every new project?
>
0 Likes
Message 3 of 7

Anonymous
Not applicable
I think you misunderstood me. I allready have subroutines/functions in VB, but since I am new to this I don't know the syntax to call up these subroutines other than retyping the subroutines in each project. I would like to put all the functions in one project, module or whatever and have a way to call up a function like I do in LISP.
0 Likes
Message 4 of 7

Anonymous
Not applicable
The subs and functions must all be declared public. Place them all in a
module together, then when you're working on a project and you need one
of your routines, add the module to the project. Call the routines by
placing the module's name in front the routine's name.
ModuleWithRoutines.aFunction
when you type in the module's name and the period the little list should
pop up




GARYNTX wrote:

> I think you misunderstood me. I allready have subroutines/functions in
> VB, but since I am new to this I don't know the syntax to call up
> these subroutines other than retyping the subroutines in each project.
> I would like to put all the functions in one project, module or
> whatever and have a way to call up a function like I do in LISP.
0 Likes
Message 5 of 7

Anonymous
Not applicable
you can create a module contaning all your functions and that module insert
in every proyect you have.
i do that. maybe someone has any other option
"GARYNTX" wrote in message
news:f0aa239.-1@WebX.maYIadrTaRb...
I am currently learning VB other than LISP, and in LISP I have a file called
"mysubr.lsp" which has all the subroutines that I use in my other LISP
files, rather than retyping the code again. (ie 'dtr' is a function to
change from degrees to radians and rather than retyping all the code I type
(dtr 90)...this is just a small example of some of the more complicated
subroutines I have.) My question is...is there a way in VB to write all my
subroutines in one file and call up each routine rather than copying or
retyping the code in every new project?
0 Likes
Message 6 of 7

Anonymous
Not applicable
"GARYNTX" wrote in message
news:f0aa239.1@WebX.maYIadrTaRb...
> I think you misunderstood me. I allready have subroutines/functions in VB,
but since I am new to this I don't know the syntax to call up these
subroutines other than retyping the subroutines in each project. I would
like to put all the functions in one project, module or whatever and have a
way to call up a function like I do in LISP.

There no syntax to 'call up' your subs in VB.

You just place your subs in a module, declare them
as public, and then add the module to the project,
and you can then call them from anywhere in same.

Unlike LISP, you can't "load" a module, you must
include in the project(s) you're going to call it
from.
0 Likes
Message 7 of 7

Anonymous
Not applicable
You can put all of your utility functions in a
separate VBA project and set a reference to that project any time you need
to use the functions it contains.  You set a reference to another VBA
project just like you would set a reference to a DLL.  It isn't a very good
solution though, because it isn't very portable.  A much better solution is
to create an ActiveX DLL, but you will need VB for that.

 

Chuck


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
am currently learning VB other than LISP, and in LISP I have a file called
"mysubr.lsp" which has all the subroutines that I use in my other LISP files,
rather than retyping the code again. (ie 'dtr' is a function to change from
degrees to radians and rather than retyping all the code I type (dtr
90)...this is just a small example of some of the more complicated subroutines
I have.) My question is...is there a way in VB to write all my subroutines in
one file and call up each routine rather than copying or retyping the code in
every new project?
0 Likes