VERSION 5.00
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} LISTBOOK 
   Caption         =   "Прием данных отчетов ""Учет …"""
   ClientHeight    =   6270
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   5385
   OleObjectBlob   =   "LISTBOOK.frx":0000
   StartUpPosition =   1  'CenterOwner
End
Attribute VB_Name = "LISTBOOK"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False


Public Result As Integer, Mode As Integer
Private Sub ImportButton_Click()
    Dim bExit As Boolean, i As Integer, bOption As Boolean
    
    bOption = OB_APPEND.Value Or OB_UPDATE.Value
    bExit = False
    For i = 0 To ListBox.ListCount - 1
        If ListBox.Selected(i) Then bExit = True
    Next i
    
    If bExit And bOption Then
        If OB_APPEND.Value Then Mode = 1
        If OB_UPDATE.Value Then Mode = 2
        Result = 1
        Me.Hide
    Else
        If Not bOption Then i = MsgBox("Не выбран режим приема.", vbOKOnly, "Внимание")
        If Not bExit Then i = MsgBox("Для приема нет отобраных книг.", vbOKOnly, "Внимание")
    End If
End Sub

Private Sub OpenButton_Click()
    Application.Dialogs(xlDialogOpen).Show
    Call ReloadListBox
End Sub

Private Sub UserForm_Initialize()
    Result = 0
    Call ReloadListBox
End Sub

Private Sub ReloadListBox()
    Dim wb As Workbook
    
    ListBox.Clear
    For Each wb In Application.Workbooks
        ListBox.AddItem (wb.Name)
    Next wb
End Sub
