VBA FreeLibrary doesn't unload DLL
问题 I need to delete a DLL file when I am done using it (cleanup after code is completed). I try using "LoadLibrary" and "FreeLibrary" in Excel VBA but no matter what I do Excel.exe clings to the DLL file. Public Declare PtrSafe Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long Public Declare PtrSafe Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long Private Sub Load_Unload_DLL() Dim lb As Long, pa As Long lb = LoadLibrary("C: