Hi all,
To begin with: I have searched the forums and google for an hour or so to find a good tutorial about creating a Visual Basic 6 DLL, which can be used by Excel VBA..
Here's the problem:
I have created a very simple
VB 6 DLL, which contains this code
Public Sub create(vrble)
MsgBox "message generated from VB6 DLL"
MsgBox vrble
Workbooks(vrble).ActiveSheet.Range("A1").Value = "test dll"
End Sub
I did the Project>References>Microsoft Excel 10.0 Library, and also the reference to my DLL in Excel VBA, in where a module contains the following code:
Sub linkdll()
Dim link As clsLinkDLL
Set link = New clsLinkDLL
link.create (ThisWorkbook.Name)
Set link = Nothing
End Sub
''''''''''''''''''''''''''
What I am trying to do, is to run a huge amount of code in an VB6 DLL, but it needs to be linked to my active workbook..
So, for instance, if I have a workbook "Test.xls", and I call a subroutine in the VB6 DLL, it needs to know which workbook is used. So I tried to pass along the name of the workbook, which works initially. The messagebox gives me the name of the workbook in the DLL, but the code after that crashes..
In simple, does anyone know how pass on a workbook, and make sure the DLL can work with that workbook (i.e. put information in cells etc.)
Help would be much appreciated (I know this should be an easy answer, but somehow I couldnt work it out)