1

Closed

How to call into LukeSkywalker.IPNetwork from within Excel VBA

description

Hi, I am trying to use the IPNetwork dll from within EXCEL VBA.
 
First I tried to add a project reference to the DLL.
However when trying to do so, I got the below error:
"Can't add a referent to the specified file"
 
I assume that is because the DLL does not have an entry point.
 
Then I have made a declaration in the module like below:
 
Private Declare Function Parse Lib "C:\LukeSkywalker.IPNetwork.dll" (ByVal strIPAddress As String) As Object
 
However when I try to call the function , I get the below error:
"Can't find DLL entry point Parse in LukeSkywalker.IPNetwork.dll"
 
This is how I call the fuction:
 
Public Function IPNetworkParse(strIPAddress As String, strProperty As String)
 
Dim oIPNetwork As Object
Dim strValue As String
 
Set oIPNetwork = Parse(strIPAddress)
 
Select Case strProperty

    Case "Network"
        strValue = oIPNetwork.network

    Case "Netmask"
        strValue = oIPNetwork.netmask

    Case "Broadcast"
        strValue = oIPNetwork.Broadcasts

    Case "FirstUsable"
        strValue = oIPNetwork.FirstUsable

    Case "LastUsable"
        strValue = oIPNetwork.LastUsable

    Case "NrOfUsable"
        strValue = oIPNetwork.NrOfUsable

    Case "CIDR"
        strValue = oIPNetwork.CIDR

End Select
End Function
 
This way I can use the wrapper-function "IPNetworkParse" in VBA code as well as in Excel spreadsheets.
 
That is if this entry-point issue could be solved.
 
Any ideas how to get around this problem?
Closed Apr 22, 2014 at 8:49 AM by LukeSkywalker

comments

LukeSkywalker wrote Apr 22, 2014 at 8:49 AM

Sorry, I don't know about Excel VBA integration. You should try a VBA expert forum.

wrote Apr 22, 2014 at 8:49 AM