First of all, what do you mean by "having trouble"? Does it simply do
nothing? Run-time error? Compiler error? Incorrect action? You might want to
post the procedure declaration so we can see how the function is declared.
To use a VB6 ActiveX DLL, you first need to register the DLL with Windows.
With Excel closed, go to the Windows Start menu, choose Run, and enter
RegSvr32 "C:\YourFolder\YourDLL.DLL"
You should get a message like "DllRegistryServer Of YourDLL.DLL Succeeded".
Then, open Excel and VBA. In the VBA Editor, go to the Tools menu and choose
References. There, scroll down to your DLL Project name (which may or may
not be the same as the DLL file name) and check that box. Then you'll need
to declare a variable of the creatable object type on the DLL and then set
that variable to a new instance of the creatable object. For example,
Public ProjObj As MyProj.MyProjObject
Sub Initialize()
Set ProjObj = New MyProj.MyProjObject
End Sub
Sub TestIt()
Dim Res As Variant
Res = ProjObj.MyFunction(1234)
End Sub
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)
"jbscotland" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Dear All,
>
> I have a VB6 DLL (called myAddin) that has a sub (called InsertRows).
> I need to make the DLL available to Excel 2000 users so I need to
> create a VBA Wrapper (called vbaInsertRows)
>
> I'm having trouble calling the DLL sub. I have tried it using a
> function and that works fine.
>
> Any help greatly appreciated.
>
> Thanks
>
> jb
>