The sections library open within Multiframe is represented via the SectionsLibrary object. This object contains a hierarchy of objects representing the groups, sections and materials stored within the library. In addition, this object is responsible for managing the loading and saving of the sections library to disk. The following tables list the properties and methods of the SectionsLibrary object.
|
Property |
Type |
Description |
|
Application |
Application |
Read Only. Returns a reference to the parent application. |
|
FullName |
String |
Read Only. Returns the file name and path of the sections library. |
|
Groups |
SectionGroups |
Read Only. Returns a reference to collection of section groups stored in the library. |
|
Materials |
Materials |
Read Only. Returns a reference to collection of materials contained in the library. |
|
Modified |
Boolean |
Read Only. Returns true if the sections library has been modified and the changes have not been saved to disk. |
|
Name |
String |
Read Only. Returns the file name of the sections library. |
|
Path |
String |
Read Only. Returns the directory path of the sections library. |
|
Method |
Returns |
Description |
|
GetSection |
Section |
Returns a reference to a specified section. |
|
Open |
|
Loads a sections library from file. |
|
Save |
|
Saves the sections library to its original file. |
|
SaveAs |
|
Saves the sections library to a specified file. |
The three methods FullName, Name, and Path describe the location of the sections library file. The Path property contains the disk path of the file, the Name property returns the name of the file while the FullName property returns the name of the file including the path.
The Modified property is used to determine if the library has been changed and needs to be saved. This property returns a value of true if the sections library has been altered. It will most commonly be used conjunction with the methods to open and save the library.
The SectionGroups and Materials properties return collections containing the groups and material stored within the sections library.
A new library is loaded into Multiframe using the Open method of the SectionsLibrary object. The following script demonstrates how to open a new sections library using VBA and Microsoft Excel. In this example the user is prompted to select the library to be opened via the File Open dialog.
Dim Filename As String
'name of file to open
Dim Filter As String ‘filter for
section library files
’Display open file dialog so user can pick new library
Filter = "Sections Library (*.slb),*.slb”
With Application
Filename =.GetOpenFilename(Filter,,
"Open Sections Library",,False)
End With
If Filename <> False ThenCall
mfApp.SectionsLibrary.Open(Filename)
End If
In Microsoft Word this script would be slightly different as a different function is used to display the File Open dialog.
’Display open file dialog so user can pick new library
With Application.Dialogs(wdDialogFileOpen)
.Name = "*.slb"
If (.Display = -1) Then
’Open new sections libray
Call
mfApp.SectionsLibrary.Open(.name,true)
End If
End With
The sections library may be saved to file using the Save or SaveAs methods. The Save method saves the library using it’s current file name and path. The SaveAs method saves the library as a new file. It would be implemented within a script in a similar was to the examples shown above for opening a library.
The simplest way to access a section within the sections library is using the GetSection method. This method provides a means of accessing a particular section without having to navigate the object hierarchy of the sections library. This method can take up to two parameters that identify the section and returns the Section object corresponding to the specified section. The first parameter is generally used to identify the group containing the section. This can be any variant value used to represent a group such as its number, name or a SectionGroup object. The second parameter is also a variant value and is used to identify the section. This may be the index of the section within the group, or it’s name. The GetSection object may also be used with only a single parameter that specifies the name of the section. In this case, the entire library will be searched to find a section with a matching name. The many ways in which the GetSection method may be used are demonstrated in the following code.
Dim mySection as Multiframe.Section
Dim myGroup as Multiframe.SectionGroup
Set mySection = mfApp.SectionsLibrary.GetSection(2,4)
Set
mySection = mfApp.SectionsLibrary.GetSection(“UB”,4)
Set
mySection = mfApp.SectionsLibrary.GetSection(“310UB40”)
Set
mySection = mfApp.SectionsLibrary.GetSection(“UB”,“310UB40”)
Set myGroup
= mfApp.SectionsLibrary.SectionGroups(“UB”)
Set
mySection = mfApp.SectionsLibrary.GetSection(myGroup,2)