OpenLib Method

Opens an existing ConceptDraw library. Returns an instance of the Library object, that corresponds to the opened library.

Applies to: Application object

Syntax

[[Set] libRet =] object.OpenLib ( fileName )

The OpenLib method syntax has these parts:

Part Description
object Required. An expression, that returns an instance of the Application object.
fileName Required. An expression that returns a String value. Contains the name of the library file including the full or relative path.
libRet Optional. A Library type variable.

Remarks

The OpenLib method is used for opening only library files - both in ConceptDraw V and ConceptDraw 1.x format. If the file with the specified fileName doesn't exist, or isn't a ConceptDraw library, the OpenLib method returns Nothing.

Example

This example contains a application-level script. It opens the library, chosen by the user, then creates a new document and copies all shapes from the library to to first page of the document.

Dim pLib As Library             ' Declare variables
Dim pDoc As Document
Dim lib_name As String

' Get filename from the user
Set lib_name = GetOpenFileName()

' Open the library with specified filename
Set plib = thisApp.OpenLib( lib_name )

If plib <> Null Then
    ' Create new document
    Set pDoc = thisApp.CreateNewDoc()

    ' Copy all shapes from the opened library to 
    ' the first page of the document
    For i=1 To plib.MastersNum()
        pDoc.Page(1).DropStamp( plib.Master(i).Shape, 700, 600 )
    Next i
End If

 

See Also

CloseLib method, CreateNewLib method, FindLib method, Lib method, LibByName method, LibsNum method, OpenLib method, Library object