Code Red > VB(A)

vba code works in 2004 but not in 2016

(1/1)

wjbzone:
I have a VBA program (LatLong.dvb) to convert coordinates from X,Y to Latitude,Longitude. It works fine in Autocad 2004 on my Windows 7 64 bit machine, but get an error in Autocad 2016. (using a calls to a DLL. )

(I installed the "AutoCAD_2016_AcVbaInstaller_Win_64bit_dlm.sfx.exe")

I also set my support File SearchPath to include the paths
   C:\LatLong
   C:\program files\corpscon6\


Below is the part of the code that I think may be my problem:

Module1 - General - Declarations:

#If VBA7 Then
Declare PtrSafe Function SetNadconPath Lib "c:\program files\corpscon6\corpscon_v6.dll" (ByVal path As String) As LongPtr
#Else
Declare Function GetNadconPath Lib "c:\program files\corpscon6\corpscon_v6.dll" (ByVal path As String) As Long
#End If


Module1 - General - convpts

Dim test7 As LongLong

test7 = SetNadconPath("c:\program files\corpscon6\nadcon")   'path to corpscon data files


The last line above causes this error:
Run-time error '48:
File not found c:\program files\corpscon6\corpscon_V6.dll


The corpscon_V6.dll is where it supposed to be, I don't know what else to try?

Please help.
Bill

MickD:
HI Bill, long time since I used vba but have you set the 'Reference' paths in your vba project to find the libraries you are using?
Or is that what you meant by support paths which I assumed your AutoCAD support paths?

n.yuan:
As you might have already be aware of, this is very likely an issue of 32bit (Acad2004) and 64bit (Acad2016).

While you may think the #If directive would solve the issue by making the external function to return correct data type according to corresponding VBA version, it probably would not work because in your #If...#Else #End If, both branches point to the same DLL files, which unlikely be both 32-bit version and 64-bit version iin the same DLL file. It is either 32-bit, or 64-bit. For Acad2016 64-bit, you'll need 64-bit version of the said DLL.

wjbzone:
Thanks for the replies. The reference paths are right in my VBA program. I contacted the USACE (US Army Corp of Engineers) and they do not have a 64 bit version of the DLL.  I attempted to install the Autodesk 32bit VBA enabler for Autocad 2016, but that will not install on a 64 bit machine.  For now I'll just use 2004 when I want to use my program.

Thinking of a workaround using a Python and some temporary text files to do the conversion.

dhawk:
There is a 64-bit version of this DLL available at https://github.com/dhawk/corpscon_v6_64bit.dll

Navigation

[0] Message Index

Go to full version