Excel 64 bit grief


I’ve recently updated to 64 bit Office (on Windows 10 64 bit) due to spreadsheet bloat, so am trying to call the epanet2.dll from Excel VBA. Am trying to get the OWA Epanet 2.1 running, since I had no problems on 32 bit Excel.

Have updated the declarations module to include 64 bit VBA 7.0 reference
#If VBA7 Then
’ 64 bit version of office VBA
Declare PtrSafe Function ENepanet Lib “epanet2.dll” (ByVal F1 As String, ByVal F2 As String, ByVal F3 As String, ByVal F4 As Any) As LongPtr
Declare PtrSafe Function ENopen Lib “epanet2.dll” (ByVal F1 As String, ByVal F2 As String, ByVal F3 As String) As LongPtr
Declare PtrSafe Function ENsaveinpfile Lib “epanet2.dll” (ByVal F As String) As LongPtr
Declare PtrSafe Function ENclose Lib “epanet2.dll” () As LongPtr

With 32 bit office, the 32 bit epanet2.dll was saved in C:\Windows\SysWOW64
so with 64 bit office, the 64 bit epanet2.dll should be saved in C:\Windows\System32

Although a bit confusing, the placement of 32 and 64 bit .dll files is as described here:


There should be no need to register the .dll using the Windows\System32 regsvr32 (trying to do so raises an error)

However, I’ve had no luck. Have tried both 32 and 64 bit .dlls in both System32 and SysWOW64 folders. Any ideas would be welcome!


Debes copiar la libreria de epanet en la carpeta “System”.
Escribí una guía en español que puedes descargarlo AQUÍ

Muchas gracias Oscar
No sabía que todavía había una carpeta Windows \ System.

Gracias por el enlace a su artículo, ¡cubre mi problema exactamente!

The solution was to copy the 64 bit epanet2.dll in to the (little used) C:\Windows\System folder. Oscar's paper covers the installation of the .dll and example use of the EPAnet toolkit in Excal VBA (64 bit).