1、Public d As StringPublic l As String Public ld As StringPublic f As StringPublic fx As StringPublic jx As StringPublic zd1 As StringPublic zd2 As StringPrivate Sub CommandButton1_Click()d = TextBox1.Textl = TextBox3.Textld = TextBox2.Textf = TextBox4.TextListBox1.AddItem d & “ “ & ld & “ “ & l & “ “
2、 & f, ListBox1.ListCountSheet1.Cells(ListBox1.ListCount, 1) = dSheet1.Cells(ListBox1.ListCount, 2) = ldSheet1.Cells(ListBox1.ListCount, 3) = lSheet1.Cells(ListBox1.ListCount, 4) = fTextBox1.Text = “TextBox2.Text = “TextBox3.Text = “TextBox4.Text = “End SubPrivate Sub CommandButton2_Click()If ListBox
3、1.ListIndex = -1 ThenMsgBox (“没有可删除的数据!“)ElseIf ListBox1.ListCount ListBox1.ListCount - 1 ThenListBox1.RemoveItem ListBox1.ListIndexSheet1.Rows(ListBox1.ListIndex + 1).DeleteElseIf ListBox1.ListIndex = ListBox1.ListCount - 1 ThenListBox1.RemoveItem ListBox1.ListIndexSheet1.Rows(ListBox1.ListIndex +
4、2).ClearEnd IfEnd SubPrivate Sub CommandButton3_Click()ListBox1.ClearSheet1.Cells.ClearTextBox1.Text = “TextBox2.Text = “TextBox3.Text = “TextBox4.Text = “End SubPrivate Sub CommandButton4_Click()TextBox4.Text = “支点“End SubPrivate Sub CommandButton5_Click()d = TextBox1.Textl = TextBox3.Textld = Text
5、Box2.Textf = TextBox4.TextListBox1.AddItem d & “ “ & ld & “ “ & l & “ “ & f, ListBox1.ListIndex + 1TextBox1.Text = “TextBox2.Text = “TextBox3.Text = “TextBox4.Text = “Sheet1.Rows(ListBox1.ListIndex + 1).InsertSheet1.Cells(ListBox1.ListIndex + 2, 1) = dSheet1.Cells(ListBox1.ListIndex + 2, 2) = ldShee
6、t1.Cells(ListBox1.ListIndex + 2, 3) = lSheet1.Cells(ListBox1.ListIndex + 2, 4) = fEnd SubPrivate Sub CommandButton6_Click() 计算每个点的坐标值并写入 sheet1Sheet1.Cells(1, 5) = Val(Sheet1.Cells(1, 3).Text) 作用点坐标Sheet1.Cells(1, 6) = Val(Sheet1.Cells(1, 2).Text) 轴肩坐标Dim i As Integeri = 2Do Until Sheet1.Cells(i, 1)
7、 = nilSheet1.Cells(i, 5) = Val(Sheet1.Cells(i - 1, 6).Text) + Val(Sheet1.Cells(i, 3).Text)Sheet1.Cells(i, 6) = Val(Sheet1.Cells(i - 1, 6).Text) + Val(Sheet1.Cells(i, 2).Text)i = i + 1LoopDim zd As StringDim i1 As Integer 找出支点位置i1 = 1Do Until Sheet1.Cells(i1, 1) = nilIf Sheet1.Cells(i1, 4) = “支点“ The
8、nzd = zd & i1 & “,“Else: zd = zdEnd Ifi1 = i1 + 1Loopzd1 = Left(zd, Val(InStr(zd, “,“) - 1) 得出支点 1 坐标zd2 = Mid(zd, Val(InStr(zd, “,“) + 1), Val(Len(zd) - Val(InStr(zd, “,“) - 1) 得出支点 2 坐标Dim i2 As Integeri2 = 1 对支点 2 求矩Do Until Sheet1.Cells(i2, 1) = nilSheet1.Cells(i2, 7) = (Val(Sheet1.Cells(i2, 5)
9、- Val(Sheet1.Cells(Val(zd2), 5) * Val(Sheet1.Cells(i2, 4)i2 = i2 + 1Loop得出支反力Dim ra As DoubleDim rb As DoubleDim Mzf As DoubleDim Fzf As DoubleDim i3 As Integeri3 = 2Mzf = Val(Sheet1.Cells(1, 7)Do Until Sheet1.Cells(i3, 1) = nilMzf = Mzf + Val(Sheet1.Cells(i3, 7)i3 = i3 + 1Loopra = Mzf / (Val(Sheet1.Cells(zd1, 5) - Val(Sheet1.Cells(zd2, 5)Dim I4 As IntegerI4 = 2Fzf = Val(Sheet1.Cells(1, 4)Fzf = Val(Sheet1.Cells(1, 4)Do Until Sheet1.Cells(i3, 1) = nilFzf = Fzf + Val(Sheet1.Cells(i3, 4)i3 = i3 + 1Looprb = Fzf - raMsgBox (rb & “ “ & ra & “ “ & Mzf & “ “ & Fzf)End Sub