Интернет-журнал 'Домашняя лаборатория', 2007 №3 - Вудворт
Шрифт:
Интервал:
Закладка:
Selection.Collapse Direction:=wdCollapseEnd.
��� ������� ������� ��������� � �������� ������ � ��� �����.
����� ����� �������� ����� � �������� �������� "Selection.TypeText ���t:="��� �����" (��������� ����� ����� "Text" �����������, ��� ��� ��� � �������� ������������ �������� ��������� �������). ����� � ������� ������������ ������ ��������� �� ������������ ������ �� ����� �������������,�� ����� ���������� ������� ����������� ������ �� ��������.
�� ��� ����������, ���� ������������ ����� ������� ��������� �����, ����� �������� ���������� � Word'e ���? ����� ���� ��������� ������ ���������. �� ����� ����� �������� � ���� ������ ��������� ����� ��������, ���� �� �������� ��������� �, ���� ���, ������� �����:
If Documents.Count = 0 Then Documents.Add
�������� ��� ���� ��������� ������. ������ "�������� ��������� � ��������" �� ������ ��������, ���� ��������� ��������� ������ (�� ���� ���� "TextBox6" �����). ��� ��� �������?
����� ����� ������ ��������� ������� �������� "CommandButton" ���� �������� "Enabled" � ���� ��� ���������� ��� "False" (�� ���� "�����"), �� ������ ����� ������������ ����� ������ � �� ����� ����������� �� ������� (������ ����������). ��� �������� ����� ������ � ���������� � �������� "CommandButton1.Enabled = False".
�������� � ��������� ���������� ���������� ���� ������, �������������� ������, ����� ��������� ����������� � ������� ��� � ����� ��������, � �������������� �� � ��������� ������, � ����� ������� � ������ ������ � ����� �������� "Enabled" ���� ������ ��� "False",�� ����� ��� ���� ���������� � ������ ������, �� ����, ��� � �����-���� ���� ����� ����� ��������� ������� � ������ ����������� ��������� ���������� ���������� � ��������� ������� ��������� ������.
��� ������� ��� ����� ���������:
Private Sub CommandButton1_Click()
If Documents.Count = 0 Then Documents.Add
Selection.Text = "��� ����������� ���� ����������� � " + TextBox1.Text + " ����� �� ���������� ������ " + TextBox4.Text + " ������, �������� " + TextBox3.Text + " ��. �� � �������� �������������� " + TextBox5.Text + " �� �� ���� �� " + TextBox2.Text + " ������ ���������" + TextBox6.Text + " ������� �������. "
Selection.Collapse Direction:=wdCollapseEnd
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub TextBox1_Change()
Scet
End Sub
Private Sub TextBox2_Change()
Scet
End Sub
Private Sub TextBox3_Change()
Scet
End Sub
Private Sub TextBox4_Change()
Scet
End Sub
Private Sub TextBox5_Change()
Scet
End Sub
Private Sub Scet()
If IsNumeric(TextBox1.Text) = True And IsNumeric(TextBox2.Text) = True And IsNumeric(TextBox3.Text) = True And IsNumeric(TextBox4.Text) = True And IsNumeric (TextBox5. Text) = True And Not Val(TextBox4.Text) = 0 And Not Val(TextBox5.Text) = 0 Then
rez = ((Val(TextBox1.Text) A 2) * Val(TextBox2.Text) * Val(TextBox3.Text)) / (Val(TextBox4.Text) * Val(TextBox5.Text))
TextBox6.Text = Str$(rez)
CommandButtonl.Enabled = True
Else
TextBox6.Text = ""
CommandButtonl.Enabled = False
End If
End Sub
(� �������, ������������ � ���������, ����������� ���������� ����� ������� ����������, � �� ���� ����. ������� �� �����������, ��� ��������� ����� �������� ������������ ��� ������� ������� ���������� � ��� ����� �����. ��� �������� ����� ����� ���� ��� �������� ���������, ����� � �������� ����������� ���������� ����� ����� ��������� ���� ��� �������� ����.)
��������� ����� ������ ��� ����� ���� ��� ������ �� Word ������,�� ��� �������� ������ ��� �������. ������� ����������� ��� ������� ����� � "Teplotok", �������� (�������� "Name" ������� "UserForm" � ����� ������ � ���� �������, ������� �����) � ������� ������, � ������� ����� ����� ���� ������� � ����� ��������� ���� �����:
Sub TeploCount()
Teplotok.Show
End Sub
������� ������ �������� ��� ("Teplo", ��������, ����� �������� "Name" ������� "������1", ���� ������ ��� ��������� ������ ����� ��� �������� � ������� ������ "��������"-"������" ������������ ���� ������ ������ ���� � ��������� ��������) � �������� � Word ������ ��� ������ ������� "Normal.Teplo.TeploCount".
��� � ��� � ���� ��������� ������! ���� �� ��������������� ��������� �� ����� ���������� ��� ����������� ����� ����, �� ������ ��������� �� ������. ������ ��������� ����� �������� �� ���������� ��������������� �������. ��� ������� ����� ����������� ����� � ������ � ��������� ������ � ������� � ��� ������ ������������ � ������� ������ �������,�� ����� ��������� ����� ����� ���������� � �� ������ ����������, ����������