• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1382
  • Last Modified:

Export VB Functions

Is it possible to export a VB function from a VB DLL to a VB EXE much like the way a C function can be exported to a VB EXE?  Oh, Yes!  Without using COM Objects.  And could you send an example?
1 Solution
I don't think so!! As far as I know, there is now way as of now!!
It is a general misunderstanding that VB dll can export function.
Public functions in a dll are not exported.
VB cannot export functions like C that can. I repeat CANNOT do that.
The only DLL's that VB can make are ActiveX dll's.

What you can do is put your functions that your want to export in a class which is "globalmultiuse" Now application that use this DLL can make a reference to this DLL like any ActiveX dll. They can now use the functions.

BTW: Using a class to reference your functions has the advantage that the location of the DLL is not important anymore. If your are referencing exported functions, that you need the location of the DLL or the DLL should be in your path.

1) Create two projects:
       a) Tstclient (Standard Exe)
       b) TstServer (ActiveX dll)

2) Add a class TstClass to TstServer

3) Change property of class to "GlobalMultiUse"

4) Add functions to TstClass

5) Add TstServer as reference to TstClient

6) Now you can use TstMyFunction1 and TstMyFunction anywhere in TstClient.
If you want to create standard DLLs that allow exported functions, see this site for a VB addin:


It is possible due to VB using the same linker as Visual C++, so a quick aleration of the linking options allows normal DLLs

Hope it helps
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now