Importing modules

J

Jag Man

I would like to import VBA modules generated by another application into
Excel. That is,
I want to create the module as ordinary text file. To this end, I have
exported a module
that I created in the VB Editor (opened from Excel Tools|Macros menu) just
to see what it
looked like. When I open it in a text editor (e.g., Notepad) I see the
following:

' Declare myFunct as a C++ function in a DLL
Private Declare Function myFunct Lib "myDLL.dll" _
(ByRef inArgs As Double, ByRef outArgs As Double) As Long


'Define a Sub that calls myFunct
Sub myFunctDriver()
Attribute myFunctDriver.VB_ProcData.VB_Invoke_Func = "m\n14" <-----
WHAT IS THIS???
Dim inArgs(1) As Double, outArgs(1) As Double
Dim ec
inArgs(0) = ThisWorkbook.Worksheets("WS1").Range("b6").Value 'x
inArgs(1) = ThisWorkbook.Worksheets("WS1").Range("b9").Value 'y
ec = myFunct(inArgs(0), outArgs(0))
If ec = 0 Then
ThisWorkbook.Worksheets("WS1").Range("h4").Value = outArgs(2) 'z
ThisWorkbook.Worksheets("WS1").Range("h5").Value = outArgs(1) 'w
End If
End Sub


' Another Sub the calls the myFunctDriver
Sub simulate()
Attribute simulate.VB_ProcData.VB_Invoke_Func = "s\n14" <----- WHAT IS
THIS???
Call myFunctDriver

End Sub

This is exactly whst I see in the VB Editor with the exception of the noted
lines (<----- WHAT IS THIS???).
Where does VB get the "m\n14" string? Is it just an arbitrary unique string
for each defined function?


TIA

jagman
 
T

Thomas Winter

Jag Man said:
I would like to import VBA modules generated by another application into
Excel. That is,
I want to create the module as ordinary text file. To this end, I have
exported a module
that I created in the VB Editor (opened from Excel Tools|Macros menu) just
to see what it
looked like. When I open it in a text editor (e.g., Notepad) I see the
following:

' Declare myFunct as a C++ function in a DLL
Private Declare Function myFunct Lib "myDLL.dll" _
(ByRef inArgs As Double, ByRef outArgs As Double) As Long


'Define a Sub that calls myFunct
Sub myFunctDriver()
Attribute myFunctDriver.VB_ProcData.VB_Invoke_Func = "m\n14" <-----
WHAT IS THIS???
Dim inArgs(1) As Double, outArgs(1) As Double
Dim ec
inArgs(0) = ThisWorkbook.Worksheets("WS1").Range("b6").Value 'x
inArgs(1) = ThisWorkbook.Worksheets("WS1").Range("b9").Value 'y
ec = myFunct(inArgs(0), outArgs(0))
If ec = 0 Then
ThisWorkbook.Worksheets("WS1").Range("h4").Value = outArgs(2) 'z
ThisWorkbook.Worksheets("WS1").Range("h5").Value = outArgs(1) 'w
End If
End Sub


' Another Sub the calls the myFunctDriver
Sub simulate()
Attribute simulate.VB_ProcData.VB_Invoke_Func = "s\n14" <----- WHAT IS
THIS???
Call myFunctDriver

End Sub

This is exactly whst I see in the VB Editor with the exception of the noted
lines (<----- WHAT IS THIS???).
Where does VB get the "m\n14" string? Is it just an arbitrary unique string
for each defined function?


TIA

jagman

VB (as oppossed to VBA) likes to add those type of things. Usually it has
something to do with how VB generate the COM server type library stuff. Its
either from VB or an Add-in to VB. You can safely delete those lines before
importing the module into VBA. Note that modules exported from VBA (as
oppossed to VB) should not have that type of stuff.

-Tom
 

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