Closes a previously opened library.
Applies to: Application object
[[Let] booleanRet =] object.CloseLib( libraryObj ) |
The CloseDoc method syntax has these parts:
Part | Description |
object | Required. An expression that returns an instance of the Application object. |
libraryObj | Required. An expression that returns an instance of the Library object (the library to be closed). |
booleanRet | Optional. A Boolean type variable. |
Note, that libraryObj must specify an open library, otherwise callingg this method may cause run-time errors. If the library window contains only one open library, closing the library also closes the library window. If the library was closed successfully, the method returns True. Otherwise (for instance, if the library has been already closed) it returns False.
This example contains an application-level script. It demonstrates using the CloseLib method. The script closes all the libraries, open in the application, except for the active library. If there is no active library, none of the libraries is closed.
Dim active_lib as Library, current_lib as Library Dim lib_count as Integer Set active_lib = thisApp.ActiveLib ' Get active library If active_lib <> Nothing Then ' if we have active library lib_count = thisApp.LibsNum() For i=lib_count To 1 Step -1 ' loop by every library Set current_lib = thisApp.Lib(i) If current_lib <> active_lib Then ' if library is not active thisApp.CloseLib( current_lib ) ' then close library End If Next i End ' End script End If MsgBox( "There is no active library now." ) |
See Also |
CloseLib method, CreateNewLib method, FindLib method, Lib method, LibByName method, LibsNum method, OpenLib method, Library object |