A package case do not understand

A package case, see Annex.
The question now is, I just copy the example code, is not it. Can not run
This example code.
The main process of Excel
Private Sub cmdDLL_Click()
Dim YJ As New MyDLL.MyClass
YJ.YunXing Me, Application ''Call Dll
Set YJ = Nothing
End Sub
In the ActiveX dll code (which is also a class module code)
'''VB encapsulates the code
'Sub YunXing(UserForm As Object, App As Object)
' Dim i As Integer, n As Integer, sum As Long
' n = UserForm.TextBox1.Text
' For i = 1 To n
' sum = sum + i
' Next
' App.ThisWorkbook.Worksheets("Sheet1").Range("A2") = "Before the implementation of the DLL "& n &" a positive integer and is: "
' App.ThisWorkbook.Worksheets("Sheet1").Range("B2") = sum
'End Sub
Turn the problem is
1, How to imitate the example, let it can be up and running. The two section of code can understand, how do I copy down can not run? Is not in the VB6 operation has a problem? Or any other details not note
2, In this way, can pass an array?

Download the examples, can be normal operation, and I get a copy of Excel file and.DLL, is unable to run
These two concepts need not to know
1, The transfer, not by the object properties?
2, YJ.YunXing Me, Application in this sentence the second parameter is not excel.application.thisworkbook?

The link below

Started by Kitty at February 08, 2016 - 2:43 AM

Dim YJ As New MyDLL.MyClass
It should be done:
Dim YJ As New MyClass

Posted by Stanford at February 19, 2016 - 3:31 AM

Sub YunXing(UserForm As Object, App As Object)

The call, to pass objects.
Call statement you should be right, transfer objects also have no wrong.

Posted by Stanford at March 02, 2016 - 3:45 AM

However, I think your Sub YinXing (second parameters),
Since you are eventually use the workbook object, it is still not as good as your Excel.Application.ThisWorkbook directly to it.

Sub YunXing( ) Such a change:
Sub YunXing(UserForm As Object,objWB As Object)
' There, the original App.ThisWorkbook.XXXXX, all replaced by objWB.XXXXX
End Sub

Call: YJ.YunXing Me, ThisWorkbook 'Dll call

Posted by Stanford at March 17, 2016 - 3:55 AM

Thank you, so soon there is a reply
The two kinds of writing can be. The latter is omitted

Posted by Kitty at March 21, 2016 - 4:23 AM

I don't understand is here
The sample code can run
And I can't run or rewrite
To change places, I think we can rewrite the place, have tried. Is not running

Posted by Kitty at March 26, 2016 - 5:07 AM

The error message is what ah?

I think you might be the cause of the error, your VBA project, no reference "MyDLL" cause.

Posted by Stanford at April 04, 2016 - 5:25 AM

This is such processing
Because the download DLL is not registered on the machine, so the example code is code
Shell "regsvr32 /s " & VBA.Chr(34) & ThisWorkbook.Path & "\MyDll.dll" & VBA.Chr(34), vbHide
Shell "regsvr32 /u /s " & VBA.Chr(34) & ThisWorkbook.Path & "\MyDll.dll" & VBA.Chr(34), vbHide
In this regard, I copied. And note the folder problem

I don't know this forum how to upload attachments, closely associated with this post together
Unable to upload attachments.

Posted by Kitty at April 05, 2016 - 5:27 AM

Only in the code Regsvr32 registration is useless, must reference the DLL file in the VBA project.

Posted by Stanford at April 10, 2016 - 6:03 AM

In the VBA editor, cited the hook played

I think now
Its code on my machine can run, so its code (VBA.DLL) is right
So what is my fault.?
The surface of the wrong, I should not. I am as its code to copy, but the VB6 editor can see to fill, tick I copy. Now I wonder, I and the home version of VB6 is not the same, or in the VB6 edit operation errors, mistakes. After all, the VB6 I learn less than a month. The basis of VBA can be, not make editing operation of low-level errors.

Posted by Kitty at April 17, 2016 - 6:23 AM

Manual registration I say is to do my own dll. Call the download and no registered DLL, reference - tools - in the VBA project, is not to see.
The problem is
In addition to the use of code (code sees the 7 floor, the path can be changed), manual registration is not ah!
Here, how should operate.?
Thank you for your detailed talk

Posted by Kitty at April 20, 2016 - 6:37 AM

You "download" to run, because the reference information has been the DLL of his VBA.
In the open the workbook, he has the code to register the DLL file.

The code is interpreted, only the calling code that key events of Sub, only need a corresponding DLL file.
This time: VBA in a reference information; a DLL type library registered in the registry.
Of course you can run, but also about what...

Refer to ActiveX DLL, is not the only path, "the last registered" place, the file exists, or directly in the System32 directory, the system can give you to find, can corresponding code execution.

Posted by Stanford at January 05, 2017 - 12:59 AM

Just learning, rookie, also want a more detailed explanation
For example, I use my VBA quoted DLL
And I don't want on my machine to compile his dll. This in my concept, his DLL is not registered in my machine.
Then, in the VBA editor, the tools, reference, is not to see his DLL
So, I'm in VBA except for the addition of 7 building code, what to do in his DLL
Hope to be able to explain in detail, and describe the steps
Thanks again!!!!

Posted by Kitty at January 05, 2017 - 1:55 AM

To "reference" ActiveX DLL, you must first register.

If you write in your own machine, after compiling DLL file, VB will help you to register.

Posted by Stanford at January 11, 2017 - 2:28 AM