Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Below are some examples of DLL definations in VBA. You need to declarre the
items outside any sub or functions. You may or may not need an alias depending on the function. From the error message you are getting it looks like you have the delcaration and probably don't have one of the parameters set properly. You would get a different error message if it didn't find the DLL or you had the alias incorrect. I would need to see the library definition to determine what is incorrect. Make sure you have all the variable that you pass to the DLL defined with a DIM statement in excel. Public Declare Function FtpSetCurrentDirectory Lib "wininet.dll" Alias "FtpSetCurrentDirectoryA" _ (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean Public Declare Function FtpGetCurrentDirectory Lib "wininet.dll" Alias "FtpGetCurrentDirectoryA" _ (ByVal hFtpSession As Long, ByVal lpszCurrentDirectory As String, lpdwCurrentDirectory As Long) As Boolean Public Declare Function InternetWriteFile Lib "wininet.dll" _ (ByVal hFile As Long, ByRef sBuffer As Byte, ByVal lNumBytesToWite As Long, _ dwNumberOfBytesWritten As Long) As Integer Public Declare Function FtpOpenFile Lib "wininet.dll" Alias "FtpOpenFileA" _ (ByVal hFtpSession As Long, ByVal sBuff As String, ByVal Access As Long, ByVal Flags As Long, ByVal Context As Long) As Long Public Declare Function FtpPutFile Lib "wininet.dll" Alias "FtpPutFileA" _ (ByVal hFtpSession As Long, ByVal lpszLocalFile As String, _ ByVal lpszRemoteFile As String, _ ByVal dwFlags As Long, ByVal dwContext As Long) As Boolean Public Declare Function FtpDeleteFile Lib "wininet.dll" _ Alias "FtpDeleteFileA" (ByVal hFtpSession As Long, _ ByVal lpszFileName As String) As Boolean Public Declare Function InternetCloseHandle Lib "wininet.dll" _ (ByVal hInet As Long) As Long Public Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" _ (ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, _ ByVal sProxyBypass As String, ByVal lFlags As Long) As Long Public Declare Function InternetConnect Lib "wininet.dll" Alias "InternetConnectA" _ (ByVal hInternetSession As Long, ByVal sServerName As String, ByVal nServerPort As Integer, _ ByVal sUsername As String, ByVal sPassword As String, ByVal lService As Long, _ ByVal lFlags As Long, ByVal lContext As Long) As Long Public Declare Function FtpGetFile Lib "wininet.dll" Alias "FtpGetFileA" _ (ByVal hFtpSession As Long, ByVal lpszRemoteFile As String, _ ByVal lpszNewFile As String, ByVal fFailIfExists As Boolean, ByVal dwFlagsAndAttributes As Long, _ ByVal dwFlags As Long, ByVal dwContext As Long) As Boolean Declare Function InternetGetLastResponseInfo Lib "wininet.dll" _ Alias "InternetGetLastResponseInfoA" _ (ByRef lpdwError As Long, _ ByVal lpszErrorBuffer As String, _ ByRef lpdwErrorBufferLength As Long) As Boolean Public Declare Function FtpFindFirstFile Lib "wininet.dll" Alias "FtpFindFirstFileA" _ (ByVal hInternetSession As Long, ByVal lpszSearchFile As String, _ ByRef lpFindFileData As WIN32_FIND_DATA, ByVal dwFlags As Long, _ ByVal dwContext As Long) As Long "Bossun" wrote: Hi, since 20th jully it's impossible to use a DLL from VBa/Excel. When I try to run my code I get this message. "Error -2147024894 file or assembly name CRMFunctions, or one of its dépendencies, was not fund" The same DLL functions very well from VBA/Access, VBA/Word, VBA/Outlook and VBScript. This DLL worked fine for 2 years even with Excel. Does anybody have an explication for this issue? Thanks |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Is it possible to call an excel function indirectly? | Excel Discussion (Misc queries) | |||
CALL .NET FUNCTION FROM EXCEL | Excel Worksheet Functions | |||
Unable to call Command Button's Click() method from a different sheet | Excel Programming | |||
Help with VB Call function from Excel | Excel Programming | |||
Unable to call external program/dll | Excel Programming |