SenSoft



Hi All,

Can any one help me on how to use Library files in Excel VBA. I have pasted here some sample. If possible which website can i refer to know about more about this. How to declare and use the constants

Private Declare Function WNetAddConnection Lib "mpr.dll" Alias "WNetAddConnectionA" (ByVal lpszNetPath As String, ByVal lpszPassword As String, ByVal lpszLocalName As String) As Long


Thanks in advance.
Bye




Re: Need Help on how to use library file (Win32 API)

João Rodrigues


Hi,

first you need to see this http://msdn2.microsoft.com/en-us/library/aa383749.aspx

An easy example:

in a VBA code module:

Option Explicit

Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)

sub aa

msgbox "test"

sleep 2000 ' 2 seconds

msgbox "test 1"

end sub

HTH

Joao Rodrigues