PC Review


Reply
Thread Tools Rate Thread

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

 
 
Vivadad
Guest
Posts: n/a
 
      18th Aug 2009
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,
 
Reply With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      18th Aug 2009
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,

 
Reply With Quote
 
Sam Wilson
Guest
Posts: n/a
 
      18th Aug 2009
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,

 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      18th Aug 2009
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" <(E-Mail Removed)> wrote in message
news:9BA9F775-DE2C-4EC2-B8E5-(E-Mail Removed)...
> 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,



 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      18th Aug 2009
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" <(E-Mail Removed)> wrote in message
news:13E0663C-29AC-4F7B-9C08-(E-Mail Removed)...
> 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,



 
Reply With Quote
 
Vivadad
Guest
Posts: n/a
 
      18th Aug 2009
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,

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Where to find explanation of files in GFI antispam folders IvanH Microsoft Outlook Discussion 1 10th Sep 2008 09:02 PM
How to find explanation of Excel error values in Help? curiousgeorge408@hotmail.com Microsoft Excel Misc 5 29th Nov 2007 08:08 AM
Find lowest 5 values in a list of 10 - 150 lists involved =?Utf-8?B?Sm9lQg==?= Microsoft Excel Misc 3 4th Aug 2004 01:31 AM
I don't find explanation. esandoval@cr.freshdelmonte.com Microsoft Outlook 0 8th Mar 2004 09:18 PM
Where can I find a newsgroup about ASP coding without .NET involved? RP Microsoft ASP .NET 1 30th Jun 2003 09:09 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:44 PM.