#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Load Dll

Does anyone know how can I load a dll from vba (excel)

Path: "C:\apps_pub\tn327080\ehllap32.dll

I need to execute this function: WaitPSSync()

Tks,
Lisandro Oliveira.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Load Dll

What do you mean by load. Do you mean you want to open and read the file.
Or do you mean that you want to copy ehllap32.dll to the path that you show.

Does WaitPSSync() require that the dll be in the directtory shown?

"Lisandro Oliveira" wrote:

Does anyone know how can I load a dll from vba (excel)

Path: "C:\apps_pub\tn327080\ehllap32.dll

I need to execute this function: WaitPSSync()

Tks,
Lisandro Oliveira.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Load Dll

You need to register the DLL if that hasn't been done.
Start | Run regsvr32 "C:\apps_pub\tn327080\ehllap32.dll"
In the VBA Editor, check it using menu Tools | References.
Declare and set an object of a public Class in the DLL, e.g.:
Dim myObj As MyDLL.Class1
Set myObj = New MyDLL.Class1
Call the function (with any required arguments):
y = myObj.Function1(x)

When done: Set myObj = Nothing

Hth,
Merjet


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Load Dll

Hi Joel,
I need to read this dll and execute the WaitPSSync() function.
This is the address "C:\apps_pub\tn327080\ehllap32.dll" where it is in my
machine.

regards,
Lisandro

"Joel" wrote:

What do you mean by load. Do you mean you want to open and read the file.
Or do you mean that you want to copy ehllap32.dll to the path that you show.

Does WaitPSSync() require that the dll be in the directtory shown?

"Lisandro Oliveira" wrote:

Does anyone know how can I load a dll from vba (excel)

Path: "C:\apps_pub\tn327080\ehllap32.dll

I need to execute this function: WaitPSSync()

Tks,
Lisandro Oliveira.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Load Dll

The DLL is loaded when the Excel file is opened, provided there's a
declaration for the WaitPSSync function in your code, and the DLL is in
either System32 or the same folder as the Excel file, in which case it's best
to change the current directory to that folder by putting "ChDir
ThisWorkbook.Path" in ThisWorkbook/Workbook_Open.

You have to be careful and know the language/compiler with which the DLL was
written, because the Declare statement in the VBA code has to have all
parameters and the return type identical with respect to both type and
calling convention (reference/value). In particular, C/C++'s default
convention is by value, but VBA's is by reference (pointer). Worse yet,
string parameters, which are pointers, should nevertheless be declared by
value, because the parameter is actually a pointer.

For example:
Public Declare Function WaitPSSync Lib "ehllap32" As Long
assumes it takes no parameters and returns a signed long

but:
Public Declare Sub WaitPSSync Lib "ehllap32" (ByVal LongParm As Long)
takes a signed long and returns nothing.

--

--Andy Smith



"Lisandro Oliveira" wrote:

Does anyone know how can I load a dll from vba (excel)

Path: "C:\apps_pub\tn327080\ehllap32.dll

I need to execute this function: WaitPSSync()

Tks,
Lisandro Oliveira.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Load Dll

Thanks for all!!!!!

I will try to do it.

regards,
Lisanro

"Andy Smith" wrote:

The DLL is loaded when the Excel file is opened, provided there's a
declaration for the WaitPSSync function in your code, and the DLL is in
either System32 or the same folder as the Excel file, in which case it's best
to change the current directory to that folder by putting "ChDir
ThisWorkbook.Path" in ThisWorkbook/Workbook_Open.

You have to be careful and know the language/compiler with which the DLL was
written, because the Declare statement in the VBA code has to have all
parameters and the return type identical with respect to both type and
calling convention (reference/value). In particular, C/C++'s default
convention is by value, but VBA's is by reference (pointer). Worse yet,
string parameters, which are pointers, should nevertheless be declared by
value, because the parameter is actually a pointer.

For example:
Public Declare Function WaitPSSync Lib "ehllap32" As Long
assumes it takes no parameters and returns a signed long

but:
Public Declare Sub WaitPSSync Lib "ehllap32" (ByVal LongParm As Long)
takes a signed long and returns nothing.

--

--Andy Smith



"Lisandro Oliveira" wrote:

Does anyone know how can I load a dll from vba (excel)

Path: "C:\apps_pub\tn327080\ehllap32.dll

I need to execute this function: WaitPSSync()

Tks,
Lisandro Oliveira.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I load an Add-ins Erin Excel Discussion (Misc queries) 4 November 11th 06 01:12 AM
On load Robert_DubYa Excel Programming 5 May 12th 06 08:58 PM
Cannot load book12 Excel Discussion (Misc queries) 1 November 11th 05 12:01 AM
load an add-in in VBA dibdab Excel Programming 1 March 3rd 04 05:11 AM
How to load another XLL in the XLL? Michael[_18_] Excel Programming 0 October 18th 03 01:49 PM


All times are GMT +1. The time now is 05:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"