Sub makros()
Dim Uspevaemost As CommandBar
Set Uspevaemost = CommandBars.Add
Uspevaemost.Name = "Uspevaemost"
Uspevaemost.Enabled = True
Uspevaemost.Position = msoBarTop
Uspevaemost.Visible = True
Dim text As String
Dim TextBox1 As CommandBarControl
Set TextBox1 = Uspevaemost.Controls.Add(Type:=msoControlEdit)
TextBox1.DescriptionText = "Фамилия"
Dim TextBox2 As CommandBarControl
Set TextBox2 = Uspevaemost.Controls.Add(Type:=msoControlEdit)
TextBox2.DescriptionText = "Имя"
Dim TextBox3 As CommandBarControl
Set TextBox3 = Uspevaemost.Controls.Add(Type:=msoControlEdit)
TextBox3.DescriptionText = "Отчество"
Dim Menu As CommandBarControl
Set Menu = Uspevaemost.Controls.Add(Type:=msoControlDropdown)
Menu.DescriptionText = "Предметы"
Menu.AddItem "Физика"
Menu.AddItem "Математика"
Menu.AddItem "Химия"
Menu.AddItem "Биология"
Menu.AddItem "Литература"
Menu.AddItem "История"
Menu.Width = 190
Dim Menu2 As CommandBarControl
Set Menu = Uspevaemost.Controls.Add(Type:=msoControlDropdown)
Menu.DescriptionText = "Оценка"
Menu.AddItem "отлично"
Menu.AddItem "хорошо"
Menu.AddItem "удов."
Menu.AddItem "не удов."
Menu.Width = 190
Dim Button1 As CommandBarButton
Set Button1 = Uspevaemost.Controls.Add(Type:=msoControlButton)
Button1.Style = msoButtonCaption
Button1.Caption = "Добавить"
Button1.OnAction = "Добавить"
Button1.OnAction = "Добавить1"
End Sub
Sub Добавить()
On Error Resume Next
Dim i, Count As Integer
Count = CommandBars("Добавить").Controls(1).ListCount
Dim Sposob As Integer
Sposob = CommandBars("Добавить данные").Controls(1).ListIndex
Dim q As String
Dim text As String
Select Case Sposob
Case 1: Selection.TypeText text:="Фихика: &" & Result
Case 2: Selection.TypeText text:="Математика: &" & Result
Case 3: Selection.TypeText text:="Химия:&" & Result
Case 4: Selection.TypeText text:="Биология: &" & Result
Case 5: Selection.TypeText text:="Литература: &" & Result
Case 6: Selection.TypeText text:="История: &" & Result
End Select
On Error GoTo 0
End Sub
Sub Добавить1()
On Error Resume Next
Dim i, Count As Integer
Count = CommandBars("Добавить").Controls(1).ListCount
Dim Sposob As Integer
Sposob = CommandBars("Добавить данные").Controls(1).ListIndex
Dim q As String
Dim text As String
Select Case Sposob
Case 1: Selection.TypeText text:="отлично: &" & Result
Case 2: Selection.TypeText text:="хорошо: &" & Result
Case 3: Selection.TypeText text:="удов.: &" & Result
Case 4: Selection.TypeText text:="не удов.: &" & Result
End Select
End Sub
...
s = "Ученик " & CommandBars("...").Controls(...).Text
s = s & " получил " & Choose(CommandBars("...").Controls(...).ListIndex+1, "отлично", "хорошо", "удовлетворительно", "не удовлетворительно")
s = s & " по предмету " & CommandBars("...").Controls(...).Text
Selection.TypeText s
...
Sub Nikitsov()
Dim Uspevaemost As CommandBar
Set Uspevaemost = CommandBars.Add
Uspevaemost.Name = "Uspevaemost"
Uspevaemost.Enabled = True
Uspevaemost.Position = msoBarTop
Uspevaemost.Visible = True
Dim TextBox1 As CommandBarControl
Set TextBox1 = Uspevaemost.Controls.Add(Type:=msoControlEdit)
TextBox1.DescriptionText = "Фамилия"
Dim TextBox2 As CommandBarControl
Set TextBox2 = Uspevaemost.Controls.Add(Type:=msoControlEdit)
TextBox2.DescriptionText = "Имя"
Dim TextBox3 As CommandBarControl
Set TextBox3 = Uspevaemost.Controls.Add(Type:=msoControlEdit)
TextBox3.DescriptionText = "Отчество"
Dim Menu As CommandBarControl
Set Menu = Uspevaemost.Controls.Add(Type:=msoControlDropdown)
Menu.DescriptionText = "Предметы"
Menu.AddItem "Физика"
Menu.AddItem "Математика"
Menu.AddItem "Химия"
Menu.AddItem "Биология"
Menu.AddItem "Литература"
Menu.AddItem "История"
Menu.Width = 190
Dim Menu1 As CommandBarControl
Set Menu1 = Uspevaemost.Controls.Add(Type:=msoControlDropdown)
Menu1.DescriptionText = "Оценка"
Menu1.AddItem "отлично"
Menu1.AddItem "хорошо"
Menu1.AddItem "удов."
Menu1.AddItem "не удов."
Menu1.Width = 190
Dim Button1 As CommandBarButton
Set Button1 = Uspevaemost.Controls.Add(Type:=msoControlButton)
Button1.Style = msoButtonCaption
Button1.Caption = "Добавить"
Button1.OnAction = "Добавить"
Button1.OnAction = "Добавить1"
End Sub
Sub Добавить()
On Error Resume Next
Dim i, Count As Integer
Count = CommandBars("Добавить").Controls(1).ListCount
Dim Sposob As Integer
Sposob = CommandBars("Добавить данные").Controls(1).ListIndex
Dim s As String
Dim q As String
Select Case Sposob
Case 1: Selection.TypeText text:="Фихика: "
Case 2: Selection.TypeText text:="Математика: "
Case 3: Selection.TypeText text:="Химия:"
Case 4: Selection.TypeText text:="Биология: "
Case 5: Selection.TypeText text:="Литература: "
Case 6: Selection.TypeText text:="История: "
End Select
On Error GoTo 0
End Sub
Sub Добавить1()
On Error Resume Next
Dim i, Count As Integer
Count = CommandBars("Добавить").Controls(1).ListCount
Dim Sposob As Integer
Sposob = CommandBars("Добавить данные").Controls(1).ListIndex
Select Case Sposob2
Case 1: Selection.TypeText text:="отлично:"
Case 2: Selection.TypeText text:="хорошо: "
Case 3: Selection.TypeText text:="удов.:"
Case 4: Selection.TypeText text:="не удов.:"
End Select
s = "Ученик " & CommandBars("Uspevaemost").Controls(1).text & CommandBars("Uspevaemost").Controls(2).text & CommandBars("Uspevaemost").Controls(3).text
s = s & " получил " & Choose(CommandBars("Uapevaemost").Controls(1).ListIndex + 1, "отлично", "хорошо", "удов.", "не удов.")
s = s & " по предмету " & CommandBars("Uaspevaemost").Controls(1).text
Selection.TypeText s
End Sub
Case 1: Selection.TypeText text:="Фихика: "
maik писал(а):Case 4: Selection.TypeText text:="не_удов.:"
Sub Nikitsov()
Dim Uspevaemost As CommandBar
Set Uspevaemost = CommandBars.Add
Uspevaemost.Name = "Uspevaemost"
Uspevaemost.Enabled = True
Uspevaemost.Position = msoBarTop
Uspevaemost.Visible = True
Dim TextBox1 As CommandBarControl
Set TextBox1 = Uspevaemost.Controls.Add(Type:=msoControlEdit)
TextBox1.DescriptionText = "Фамилия"
Dim TextBox2 As CommandBarControl
Set TextBox2 = Uspevaemost.Controls.Add(Type:=msoControlEdit)
TextBox2.DescriptionText = "Имя"
Dim TextBox3 As CommandBarControl
Set TextBox3 = Uspevaemost.Controls.Add(Type:=msoControlEdit)
TextBox3.DescriptionText = "Отчество"
Dim Menu As CommandBarControl
Set Menu = Uspevaemost.Controls.Add(Type:=msoControlDropdown)
Menu.DescriptionText = "Предметы"
Menu.AddItem "Физика"
Menu.AddItem "Математика"
Menu.AddItem "Химия"
Menu.AddItem "Биология"
Menu.AddItem "Литература"
Menu.AddItem "История"
Menu.Width = 190
Dim Menu1 As CommandBarControl
Set Menu1 = Uspevaemost.Controls.Add(Type:=msoControlDropdown)
Menu1.DescriptionText = "Оценка"
Menu1.AddItem "отлично"
Menu1.AddItem "хорошо"
Menu1.AddItem "удов."
Menu1.AddItem "не удов."
Menu1.Width = 190
Dim Button1 As CommandBarButton
Set Button1 = Uspevaemost.Controls.Add(Type:=msoControlButton)
Button1.Style = msoButtonCaption
Button1.Caption = "Добавить"
Button1.OnAction = "Добавить"
Button1.OnAction = "Добавить1"
End Sub
Sub Добавить()
On Error Resume Next
Dim i, Count As Integer
Count = CommandBars("Добавить").Controls(1).ListCount
Dim Sposob As Integer
Sposob = CommandBars("Добавить данные").Controls(1).ListIndex
Dim q As String
Select Case Sposob
Case 1: Selection.TypeText text:="Физика: "
Case 2: Selection.TypeText text:="Математика: "
Case 3: Selection.TypeText text:="Химия:"
Case 4: Selection.TypeText text:="Биология: "
Case 5: Selection.TypeText text:="Литература: "
Case 6: Selection.TypeText text:="История: "
End Select
On Error GoTo 0
End Sub
Sub Добавить1()
On Error Resume Next
Dim i, Count As Integer
Count = CommandBars("Добавить").Controls(1).ListCount
Dim Sposob As Integer
Sposob = CommandBars("Добавить данные").Controls(2).ListIndex
Select Case Sposob
Case 1: Selection.TypeText text:="отлично"
Case 2: Selection.TypeText text:="хорошо "
Case 3: Selection.TypeText text:="удов."
Case 4: Selection.TypeText text:="неудов."
End Select
s = " получил " & CommandBars("Uapevaemost").Controls(5).ListIndex
s = " Ученик " & CommandBars("Uspevaemost").Controls(1).text & CommandBars("Uspevaemost").Controls(2).text & CommandBars("Uspevaemost").Controls(3).text
s = s & " по предмету " & CommandBars("Uaspevaemost").Controls(4).text
Selection.TypeText s
End Sub
может, кто ни будь, подскажет, как сделать, чтобы со всех списков выводилось и между именем фамилию и отчеством были пробелы??
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 114