VBA Activex.dll?

A

Aidy

Is it possible to import a VBA class module and create a Activex.dll from it in VB?

Aidy
 
J

Jonathan West

Hi Aidy

The answer is a definite maybe.

Yes, you can export from VBA
Yes, you can import that class module into a VB6 ActiveX DLL project (Note,
not VB.NET, the syntax is different)
No, it might not work correctly without modification.

At least you will probably have to set a reference in the VB project to the
Office application (i.e. Word or Excel or whatever) the class was running
under.

If the class calls UserForms, then you might want to rewrite those as Forms.
 
K

Karl E. Peterson

Aidy said:
Is it possible to import a VBA class module and create a Activex.dll from it
in VB?

Yes. It may be problematic, though, if the class module relies heavily on the Office
object model. If it's "just" VBA code, it should be dropdead simple.
 
A

Aidy

Is there another way of instantiating a VBA class from another COM
enabled product?

The class is in the object browser, but I am not sure of the object
hierarchy I follow?

Also in the object browser there is an 'Aproject' class with a
RunMacro method. Could I try to run the sub that instantiates the
class?

Aidy
 
J

Jonathan West

Aidy said:
Is there another way of instantiating a VBA class from another COM
enabled product?

The class is in the object browser, but I am not sure of the object
hierarchy I follow?

Also in the object browser there is an 'Aproject' class with a
RunMacro method. Could I try to run the sub that instantiates the
class?

Lets take a step back here. Forget about instantiation & all the rest of it.
Describe what you class does and what you are trying to achieve overall. I
suspect there is an easier approach to all this.

Also could you let us know which Office application your VBA projects is
working in? The object models of the different Office applications are very
different from each other, and a solution that works for one might not work
for another.
 
A

Aidy

Jonathan West said:
Also could you let us know which Office application your VBA projects is
working in?

I am trying to automatically test a Mainframe app through a terminal
emulator. The emulator has a vba scripting language built in. I have
referenced the emulator objects in Excel VBA so I have the power of
both VBA's.

I am using a class module because of this statement

"Private WithEvents m_ttHost As teemtalk.Host"

Thanks

Aidy
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Top