ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ATPVBAEN.xla!Moveavg- where to find explanation of arg involved. (https://www.excelbanter.com/excel-programming/432545-atpvbaen-xla-moveavg-where-find-explanation-arg-involved.html)

Vivadad

ATPVBAEN.xla!Moveavg- where to find explanation of arg involved.
 
For ATP and similar add-in, I always confused where I can get details how to
use their inbuilt functions. Also, any library souce for me to know what
function i can pick out to use form which "possible add-in" (including xla,
dll etc.)
thanks,

joel

ATPVBAEN.xla!Moveavg- where to find explanation of arg involved.
 
You can use any DLL in a VBA macro by defining the call to the library
function, Here is an example

' Declare wininet.dll API Functions
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



Usually I go to microsfot.com and find the paraemeter list and entry points
for the library function. There is some manpulating of the parameter
definitions that you have to do. For example parameters which are pointers
are defined in VBA as Long. Then you have to define a TYPE (in place of a
structure in C language) in VBA like this

Type WIN32_FIND_DATA
dwFileAttributes As Long
ftCreationTime As Currency
ftLastAccessTime As Currency
ftLastWriteTime As Currency
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * MAX_PATH
cAlternate As String * 14
End Type

This type is used below

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



"Vivadad" wrote:

For ATP and similar add-in, I always confused where I can get details how to
use their inbuilt functions. Also, any library souce for me to know what
function i can pick out to use form which "possible add-in" (including xla,
dll etc.)
thanks,


Sam Wilson

ATPVBAEN.xla!Moveavg- where to find explanation of arg involved.
 
In the VBE window press F2 to bring up the object browser - left click
ATPVBAEN.xla in the project window and choose atpvbaen.xls in the object
browser - all functions are listed there.

"Vivadad" wrote:

For ATP and similar add-in, I always confused where I can get details how to
use their inbuilt functions. Also, any library souce for me to know what
function i can pick out to use form which "possible add-in" (including xla,
dll etc.)
thanks,


Peter T

ATPVBAEN.xla!Moveavg- where to find explanation of arg involved.
 
Hi Joel,

The OP is asking how to use functions in the ATPVBAEN.xla. This addin is a
glorified wrapper to call functions in ANALYS32.XLL. Normally for VBA to
call functions in an XLL means using Application.Run (after Registering the
functions). In theory, even though documented otherwise, it should be
possible to call functions directly from an XLL without app.run. However I
have not managed to do that from the ATP xll, possibly due to
incomplete/incorrect use of LPXLOPER __stdcall. Do you know how to write the
declarations?

Regards,
Peter T

"Joel" wrote in message
...
You can use any DLL in a VBA macro by defining the call to the library
function, Here is an example

' Declare wininet.dll API Functions
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



Usually I go to microsfot.com and find the paraemeter list and entry
points
for the library function. There is some manpulating of the parameter
definitions that you have to do. For example parameters which are
pointers
are defined in VBA as Long. Then you have to define a TYPE (in place of a
structure in C language) in VBA like this

Type WIN32_FIND_DATA
dwFileAttributes As Long
ftCreationTime As Currency
ftLastAccessTime As Currency
ftLastWriteTime As Currency
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * MAX_PATH
cAlternate As String * 14
End Type

This type is used below

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



"Vivadad" wrote:

For ATP and similar add-in, I always confused where I can get details how
to
use their inbuilt functions. Also, any library souce for me to know what
function i can pick out to use form which "possible add-in" (including
xla,
dll etc.)
thanks,




Peter T

ATPVBAEN.xla!Moveavg- where to find explanation of arg involved.
 
Just to add, either set a reference to the addin in your project
(tools/references) or do as Sam suggests, find your functions in Object
browser then use the Application.Run method

Regards,
Peter T

"Sam Wilson" wrote in message
...
In the VBE window press F2 to bring up the object browser - left click
ATPVBAEN.xla in the project window and choose atpvbaen.xls in the object
browser - all functions are listed there.

"Vivadad" wrote:

For ATP and similar add-in, I always confused where I can get details how
to
use their inbuilt functions. Also, any library souce for me to know what
function i can pick out to use form which "possible add-in" (including
xla,
dll etc.)
thanks,




Vivadad

ATPVBAEN.xla!Moveavg- where to find explanation of arg involved.
 
Thanks to all you helping.
My key question where I can know the exact requirement in the parameters of
a function call out from an add-in.
Next: Moveavg, what is the differnece from MoveavgQ.
Still question on Moveavg, I use MA(20) on a data column L2:L33, destination
at W2. I wish to get stdevp at teh same time, I tick standand error box, but
got wrong message which I could not understand nor get any library info
explaining what being required.
vba line

Applicaiton.Run
"ATPVBAEN.xla!Moveravg",Activesheet.Range("L2:L33" ).Activesheet.range($W$2"),20, true,false, false
error message

" moving Average- Estimated output table will extend beyond the bounds of
the worksheet. Please choose different reference".......how to resolve?
Next, on a broader level, where I can find the official quide on using
functions of a library?.....any such publishes from microsoft

To Joel, on the DLL, your mentioned "parameter list on micirosoft.com, I
need time to attempt.



"Vivadad" wrote:

For ATP and similar add-in, I always confused where I can get details how to
use their inbuilt functions. Also, any library souce for me to know what
function i can pick out to use form which "possible add-in" (including xla,
dll etc.)
thanks,



All times are GMT +1. The time now is 01:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com