PC Review


Reply
Thread Tools Rate Thread

Call VB6 DLL from VBA wrapper

 
 
jbscotland
Guest
Posts: n/a
 
      17th Sep 2007
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

 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      17th Sep 2007
The sub works exactly the same as the function. What are you using to call
it?

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"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
>



 
Reply With Quote
 
Chip Pearson
Guest
Posts: n/a
 
      17th Sep 2007
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
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to call non-COM legacy dll from ASP.NET -OR- write COM wrapper in C# Chris Bordeman Microsoft ASP .NET 8 11th Apr 2008 02:37 AM
Using C++/CLI wrapper to call .NET assembly from native code? cctv.star@gmail.com Microsoft VC .NET 2 29th Jun 2007 10:10 PM
Call C/C++ CALLBACK DLL from C# (PInvoke? Wrapper class?) MyCrystalGift@gmail.com Microsoft C# .NET 2 9th Mar 2007 07:31 PM
wrapper in .NET 1.1 to call a .NET 2 WT Microsoft C# .NET 2 15th Mar 2006 02:59 PM
Call VB6 DLL from Worksheet without VBA wrapper Lawrence Microsoft Excel Programming 2 19th Sep 2003 10:04 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:10 PM.