📄 frm电量平衡.frm
字号:
End If
Set RS = ZHCX.Execute(sql1, 0)
If RS.State Then
RS.Close
End If
Else
A = MsgBox("表码的平衡电量输入有问题,请检查输入!", vbOKOnly, "错误")
End If
If (IsNumeric(Text6.Text)) And (IsNumeric(Text7.Text)) And (IsNumeric(Text8.Text)) And (IsNumeric(Text9.Text)) And (IsNumeric(Text10.Text)) Then
sql1 = "select * from xdgl_dlph where rq='" & DTPicker1.Value & "' and bdz='" & Trim(Combo2.Text) & "' and jld='" & Trim(Combo1.Text) & "' and dllx='止码' and dydj='" & Trim(Combo3.Text) & "'"
Set RS = ZHCX.Execute(sql1, 0)
If RS.EOF Then
sql1 = "insert xdgl_dlph (rq,dllx,bdz,jld,d_1,d_2,d_3,d_4,d_z,dydj) values('" & DTPicker1.Value & "','止码','" & Trim(Combo2.Text) & "','" & Trim(Combo1.Text) & "'," & Trim(Text10.Text) & "," & Trim(Text9.Text) & "," & Trim(Text8.Text) & "," & Trim(Text7.Text) & "," & Trim(Text6.Text) & ",'" & Trim(Combo3.Text) & "')"
Else
sql1 = "update xdgl_dlph set d_1=" & Text10.Text & ",d_2=" & Text9.Text & ",d_3=" & Text8.Text & ",d_4=" & Text7.Text & ",d_z=" & Text6.Text & " where rq='" & DTPicker1.Value & "' and bdz='" & Trim(Combo2.Text) & "' and jld='" & Trim(Combo1.Text) & "' and dllx='止码' and dydj='" & Trim(Combo3.Text) & "'"
End If
If RS.State Then
RS.Close
End If
Set RS = ZHCX.Execute(sql1, 0)
If RS.State Then
RS.Close
End If
sql1 = "insert xdgl_dlph (rq,dllx,bdz,jld,d_1,d_2,d_3,d_4,d_z,dydj) values('" & DateAdd("M", 1, DTPicker1.Value) & "','起码','" & Trim(Combo2.Text) & "','" & Trim(Combo1.Text) & "'," & Trim(Text10.Text) & "," & Trim(Text9.Text) & "," & Trim(Text8.Text) & "," & Trim(Text7.Text) & "," & Trim(Text6.Text) & ",'" & Trim(Combo3.Text) & "')"
Debug.Print sql1
sql2 = "delete from xdgl_dlph where rq='" & DateAdd("M", 1, DTPicker1.Value) & "' and dllx='起码' and jld='" & Trim(Combo1.Text) & "' and bdz='" & Trim(Combo2.Text) & "' and dydj='" & Trim(Combo3.Text) & "'"
Debug.Print sql2
Set RS = ZHCX.Execute(sql2, 0)
Set RS = ZHCX.Execute(sql1, 0)
Else
A = MsgBox("止码的平衡电量输入有问题,请检查输入!", vbOKOnly, "错误")
Exit Sub
End If
Adodc1.Refresh
Call sx
Call Close_link
End Sub
Private Sub Command2_Click()
Dim b(3) As String
Dim sendexcel As Excel.Application
Set sendexcel = CreateObject("Excel.Application")
sendexcel.Visible = True
sendexcel.Workbooks.Add
Call Open_link
sendexcel.Columns("A:A").ColumnWidth = 3.88
sendexcel.Range("A1:W1").Select
sendexcel.ActiveWindow.ScrollColumn = 1
With sendexcel.Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
sendexcel.Selection.Merge
sendexcel.ActiveWindow.ScrollColumn = 4
sendexcel.ActiveWindow.ScrollColumn = 12
sendexcel.ActiveWindow.ScrollColumn = 14
sendexcel.ActiveWindow.ScrollColumn = 1
sendexcel.Rows("1:1").RowHeight = 22.5
sendexcel.Rows("1:1").RowHeight = 29.25
sendexcel.Range("A1:W1").Select
With sendexcel.Selection.Font
.Name = "宋体"
.Size = 24
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With sendexcel.Selection.Font
.Name = "隶书"
.Size = 24
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
sendexcel.ActiveWindow.ScrollColumn = 7
sendexcel.ActiveWindow.ScrollColumn = 1
sendexcel.Rows("1:1").RowHeight = 34.5
sendexcel.ActiveWindow.ScrollColumn = 6
sendexcel.ActiveWindow.ScrollColumn = 1
With sendexcel.Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = True
End With
sendexcel.ActiveWindow.ScrollColumn = 10
sendexcel.ActiveWindow.ScrollColumn = 6
sendexcel.ActiveWindow.ScrollColumn = 14
sendexcel.Range("U2:W2").Select
With sendexcel.Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
sendexcel.Selection.Merge
sendexcel.Range("U2:W2").Select
sendexcel.ActiveCell.FormulaR1C1 = "制表人: 计量单位:万kWH"
With sendexcel.ActiveCell.Characters(Start:=1, Length:=6).Font
.Name = "宋体"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With sendexcel.ActiveCell.Characters(Start:=7, Length:=3).Font
.Name = "Times New Roman"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
sendexcel.Range("U2:W2").Select
sendexcel.Rows("2:2").RowHeight = 18
sendexcel.ActiveWindow.ScrollColumn = 1
sendexcel.Range("A3:A4").Select
With sendexcel.Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
sendexcel.Selection.Merge
sendexcel.Range("B3:B4").Select
With sendexcel.Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
sendexcel.Selection.Merge
sendexcel.Range("B3:B4").Select
sendexcel.ActiveCell.FormulaR1C1 = "计量关口"
sendexcel.Range("C3:C4").Select
sendexcel.ActiveCell.FormulaR1C1 = "计量方法"
sendexcel.Range("D3:H3").Select
With sendexcel.Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
sendexcel.Selection.Merge
sendexcel.ActiveCell.FormulaR1C1 = "止步码"
sendexcel.Range("d3:h3").Select
sendexcel.ActiveCell.FormulaR1C1 = "止码"
sendexcel.Range("d4").Select
sendexcel.ActiveCell.FormulaR1C1 = "尖"
sendexcel.Range("e4").Select
sendexcel.ActiveCell.FormulaR1C1 = "峰"
sendexcel.Range("f4").Select
sendexcel.ActiveCell.FormulaR1C1 = "平"
sendexcel.Range("g4").Select
sendexcel.ActiveCell.FormulaR1C1 = "谷"
sendexcel.Range("h4").Select
sendexcel.ActiveCell.FormulaR1C1 = "总"
sendexcel.Range("i3").Select
sendexcel.ActiveWindow.ScrollColumn = 5
sendexcel.Range("i3:m3").Select
With sendexcel.Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
sendexcel.Selection.Merge
sendexcel.ActiveCell.FormulaR1C1 = "起码"
sendexcel.Range("d4:h4").Select
sendexcel.Selection.Copy
sendexcel.Range("i4:m4").Select
sendexcel.ActiveSheet.Paste
sendexcel.ActiveWindow.ScrollColumn = 8
sendexcel.Range("n3:r3").Select
sendexcel.Application.CutCopyMode = False
With sendexcel.Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
sendexcel.Selection.Merge
sendexcel.ActiveCell.FormulaR1C1 = "表码"
sendexcel.Range("i4:m4").Select
sendexcel.Selection.Copy
sendexcel.Range("n4:r4").Select
sendexcel.ActiveSheet.Paste
sendexcel.ActiveWindow.ScrollColumn = 12
sendexcel.Range("t3:x3").Select
sendexcel.Application.CutCopyMode = False
With sendexcel.Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
sendexcel.Selection.Merge
sendexcel.Range("t4").Select
sendexcel.ActiveWindow.SmallScroll ToRight:=-3
sendexcel.Range("n4:r4").Select
sendexcel.Selection.Copy
sendexcel.ActiveWindow.ScrollColumn = 14
sendexcel.Range("t4:x4").Select
sendexcel.ActiveSheet.Paste
sendexcel.Range("s3:s4").Select
sendexcel.Application.CutCopyMode = False
With sendexcel.Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
sendexcel.Selection.Merge
sendexcel.ActiveCell.FormulaR1C1 = "倍率"
sendexcel.Range("t11").Select
sendexcel.ActiveWindow.ScrollColumn = 1
sendexcel.Rows("2:4").Select
With sendexcel.Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
End With
sendexcel.Range("d3:h3").Select
sendexcel.ActiveCell.FormulaR1C1 = "止 码"
With sendexcel.ActiveCell.Characters(Start:=1, Length:=1).Font
.Name = "宋体"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With sendexcel.ActiveCell.Characters(Start:=2, Length:=9).Font
.Name = "Times New Roman"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With sendexcel.ActiveCell.Characters(Start:=11, Length:=1).Font
.Name = "宋体"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
sendexcel.Range("i3:m3").Select
sendexcel.ActiveCell.FormulaR1C1 = "起 码"
With sendexcel.ActiveCell.Characters(Start:=1, Length:=1).Font
.Name = "宋体"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With sendexcel.ActiveCell.Characters(Start:=2, Length:=8).Font
.Name = "Times New Roman"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With sendexcel.ActiveCell.Characters(Start:=10, Length:=1).Font
.Name = "宋体"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
sendexcel.Range("d3:h3").Select
sendexcel.ActiveCell.FormulaR1C1 = "止 码"
With sendexcel.ActiveCell.Characters(Start:=1, Length:=1).Font
.Name = "宋体"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -