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.

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

João Rodrigues


first you need to see this

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


Joao Rodrigues