Hi Cedric,

I'ld like to know if it's possible to get the name of the library containing the currently running macro in Basic. Is there something like getCurrentLibraryName() in the following code ?

there's no built-in command for this. I can only
offer you a workaround, but it's not very elegant.

You could place your own code inside each module
or library. As subs/function inside the own module
or library are always found first this would work.

Example including the module name:

' Code in Standard.Module1:
Sub Test
    msgbox getModuleName()
    TestMod2
    TestLib1Mod1
End Sub
        
function getModuleName()
    getModuleName = "Standard.Module1"
end function


' Code in Standard.Module2:
Sub TestMod2
    msgbox getModuleName()
End Sub
        
function getModuleName()
    getModuleName = "Standard.Module2"
end function


' Code in Library1.Module1:
Sub TestLib1Mod1
    msgbox getModuleName()
End Sub
        
function getModuleName()
    getModuleName = "Library1.Module1"
end function


Then starting Standard.Module1.Test prints
"Standard.Module1"
"Standard.Module2"
"Library1.Module1"


If you are really only interested in the library name
one function getLibraryName() in each library will do.
It doesn't matter in which of the library's module
you place it.

Regards

Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to