Option Strict Off Imports Microsoft.Office.Interop.Excel.XlUnderlineStyle Imports Microsoft.Office.Interop.Excel.Constants Imports Microsoft.Office.Interop.Excel.XlBordersIndex Imports Microsoft.Office.Interop.Excel.XlLineStyle Imports Microsoft.Office.Interop.Excel.XlBorderWeight Imports Microsoft.Office.Interop.Excel.XlThemeFont Imports Microsoft.Office.Interop.Excel.XlThemeColor Imports Microsoft.Office.Interop.Excel.XlWindowState Imports Microsoft.Office.Interop.Excel Public Class 業務佣金計算 ReadOnly ds As New DataSet Dim 新項次 As String Dim xlApp As Application : Dim xlBook As Workbook : Dim xlSheet As Worksheet : Dim N1 As Integer Private Sub Set_業務佣金清單() DataGridView1.DataSource = Nothing : ds.Clear() : DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing : DataGridView1.ColumnHeadersHeight = 25 DataGridView1.AllowUserToAddRows = False : DataGridView1.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithoutHeaderText : DataGridView1.MultiSelect = True SQL_業務佣金計算清單() da.Fill(ds) : DataGridView1.DataSource = ds.Tables(0) : conn.Close() DataGridView1.Columns(0).FillWeight = 100 : DataGridView1.Columns(1).FillWeight = 80 : DataGridView1.Columns(2).FillWeight = 80 : DataGridView1.Columns(3).FillWeight = 250 DataGridView1.Columns(4).FillWeight = 80 : DataGridView1.Columns(5).FillWeight = 80 : DataGridView1.Columns(6).FillWeight = 80 : DataGridView1.Columns(7).FillWeight = 80 DataGridView1.Columns(8).FillWeight = 80 : DataGridView1.Columns(9).FillWeight = 60 : DataGridView1.Columns(10).FillWeight = 60 : DataGridView1.Columns(11).Visible = False DataGridView1.Columns(4).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(5).DefaultCellStyle.Format = "#,##0" DataGridView1.Columns(7).DefaultCellStyle.Format = "#,##0.0" : DataGridView1.Columns(8).DefaultCellStyle.Format = "#,##0" DataGridView1.Columns(0).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(0).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter DataGridView1.Columns(1).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(1).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter DataGridView1.Columns(2).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(2).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter DataGridView1.Columns(4).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(4).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter DataGridView1.Columns(5).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(5).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter DataGridView1.Columns(6).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(6).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter DataGridView1.Columns(7).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(7).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter DataGridView1.Columns(8).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(8).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter TextBox1.Text = "0" For I As Integer = 0 To 9 : DataGridView1.Columns(I).ReadOnly = True : Next For I As Integer = 0 To DataGridView1.Rows.Count - 1 If DataGridView1.Rows(I).Cells("已立帳").Value.ToString = "" Then : DataGridView1.Rows(I).Cells("已立帳").Value = False : End If DataGridView1.Rows(I).Cells("選擇").Value = False : TextBox1.Text = Val(TextBox1.Text) + DataGridView1.Rows(I).Cells("佣金").Value Next TextBox1.Text = Strings.Format(Val(TextBox1.Text), "#,##0") End Sub Private Sub ComboBox2下拉表單資料載入() SQL_銷售業務人員清單() ComboBox2.Items.Clear() : While (dr.Read()) : ComboBox2.Items.Add(dr("業務")) : End While : conn.Close() End Sub Private Sub ComboBox1下拉表單資料載入() SQL_會計科目_第一階_不含流動票務() ComboBox5.Items.Clear() : ComboBox1.Items.Clear() : While (dr.Read()) : ComboBox5.Items.Add(dr("第一階")) : ComboBox1.Items.Add(dr("編號")) : End While : conn.Close() End Sub Private Sub ComboBox3下拉表單資料載入() PA = ComboBox1.Text : SQL_會計科目_第二階_不含流動票務() ComboBox3.Items.Clear() : ComboBox4.Items.Clear() : While (dr.Read()) : ComboBox3.Items.Add(dr("第二階")) : ComboBox4.Items.Add(dr("編號")) : End While : conn.Close() : PA = "" End Sub Private Sub ComboBox6下拉表單資料載入() PA = ComboBox4.Text : SQL_會計科目_第三階_不含流動票務() ComboBox7.Items.Clear() : ComboBox6.Items.Clear() : While (dr.Read()) : ComboBox7.Items.Add(dr("會計科目")) : ComboBox6.Items.Add(dr("編號")) : End While : conn.Close() If ComboBox7.Items.Count <> 0 Then : ComboBox7.SelectedIndex = 0 : End If End Sub Private Sub 日期格式() If 會計月.Checked = True Then '-------------日期一---------------------------------------------------------------------------------------- DTP = Strings.Left(Strings.Format(DateTimePicker1.Value, "yyyy/MM/dd"), 8) & "01" : DateTimePicker1.Value = DTP DateTimePicker1.Value = DateTimePicker1.Value.AddMonths(-1) DTP = Strings.Left(Strings.Format(DateTimePicker1.Value, "yyyy/MM/dd"), 8) & "26" : DateTimePicker1.Value = DTP '-------------日期二---------------------------------------------------------------------------------------- DTP = Strings.Left(Strings.Format(DateTimePicker2.Value, "yyyy/MM/dd"), 8) & "25" : DateTimePicker2.Value = DTP Else '-------------日期一---------------------------------------------------------------------------------------- DateTimePicker1.Value = DateTimePicker1.Value.AddMonths(1) DTP = Strings.Left(Strings.Format(DateTimePicker1.Value, "yyyy/MM/dd"), 8) & "01" : DateTimePicker1.Value = DTP '-------------日期二---------------------------------------------------------------------------------------- DTP = Strings.Left(Strings.Format(DateTimePicker2.Value, "yyyy/MM/dd"), 8) & "01" : DateTimePicker2.Value = DTP DateTimePicker2.Value = DateTimePicker2.Value.AddMonths(1) : DateTimePicker2.Value = DateTimePicker2.Value.AddDays(-1) End If End Sub Private Sub 業務佣金計算_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.MdiParent = MAOJI_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True ComboBox6.Visible = False : TextBox2.Visible = False : DateTimePicker4.Visible = False ComboBox1下拉表單資料載入() : ComboBox3下拉表單資料載入() : ComboBox6下拉表單資料載入() : ComboBox2下拉表單資料載入() : ComboBox2.SelectedIndex = 0 : 日期格式() : Set_業務佣金清單() End Sub Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick If e.RowIndex = -1 Then : Else TextBox3.Text = DataGridView1.Rows(e.RowIndex).Cells("單據編號").Value End If End Sub Private Sub DataGridView1_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles DataGridView1.RowPostPaint Dim linePen As New Pen(Color.Blue, 2) If e.RowIndex = DataGridView1.Rows.Count - 1 Then : Exit Sub Else If DataGridView1(0, e.RowIndex).Value.ToString <> DataGridView1(0, e.RowIndex + 1).Value.ToString Then Dim startX As Integer = IIf(DataGridView1.RowHeadersVisible, DataGridView1.RowHeadersWidth, 0) Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1 Dim endX As Integer = startX + DataGridView1.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView1.HorizontalScrollingOffset e.Graphics.DrawLine(linePen, startX, startY, endX, startY) : Exit Sub End If End If End Sub Private Sub ComboBox5_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox5.TextChanged ComboBox1.SelectedIndex = ComboBox5.SelectedIndex : TextBox9.Text = "" : ComboBox3下拉表單資料載入() : ComboBox6下拉表單資料載入() End Sub Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.TextChanged ComboBox5.SelectedIndex = ComboBox1.SelectedIndex : ComboBox3下拉表單資料載入() : ComboBox6下拉表單資料載入() End Sub Private Sub ComboBox3_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox3.TextChanged ComboBox4.SelectedIndex = ComboBox3.SelectedIndex : ComboBox6下拉表單資料載入() End Sub Private Sub ComboBox4_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox4.TextChanged ComboBox3.SelectedIndex = ComboBox4.SelectedIndex : ComboBox6下拉表單資料載入() End Sub Private Sub ComboBox7_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox7.SelectedIndexChanged ComboBox6.SelectedIndex = ComboBox7.SelectedIndex End Sub Private Sub ComboBox6_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox6.SelectedIndexChanged ComboBox7.SelectedIndex = ComboBox6.SelectedIndex End Sub Private Sub TextBox9_TextChanged(sender As Object, e As EventArgs) Handles TextBox9.TextChanged PA = TextBox9.Text : SQL_會計科目_關鍵字_不含流動票務() ComboBox7.Items.Clear() : ComboBox6.Items.Clear() : While (dr.Read()) : ComboBox7.Items.Add(dr("會計科目")) : ComboBox6.Items.Add(dr("編號")) : End While : conn.Close() If ComboBox7.Items.Count <> 0 Then : ComboBox7.SelectedIndex = 0 : End If : PA = "" End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click If 會計月.Checked = True Then DateTimePicker4.Value = DateTimePicker4.Value.AddMonths(-1) DateTimePicker1.Value = DateTimePicker4.Value DateTimePicker2.Value = DateTimePicker4.Value Else DateTimePicker4.Value = DateTimePicker4.Value.AddMonths(-1) DateTimePicker1.Value = DateTimePicker4.Value.AddMonths(-1) DateTimePicker2.Value = DateTimePicker4.Value End If 日期格式() : Set_業務佣金清單() End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click If 會計月.Checked = True Then DateTimePicker4.Value = DateTimePicker4.Value.AddMonths(1) DateTimePicker1.Value = DateTimePicker4.Value DateTimePicker2.Value = DateTimePicker4.Value Else DateTimePicker4.Value = DateTimePicker4.Value.AddMonths(1) DateTimePicker1.Value = DateTimePicker4.Value.AddMonths(-1) DateTimePicker2.Value = DateTimePicker4.Value End If 日期格式() : Set_業務佣金清單() End Sub Private Sub 會計月_CheckedChanged(sender As Object, e As EventArgs) Handles 會計月.Click 會計月.Checked = True : 一般月.Checked = False : 日期格式() : Set_業務佣金清單() End Sub Private Sub 一般月_CheckedChanged(sender As Object, e As EventArgs) Handles 一般月.Click 會計月.Checked = False : 一般月.Checked = True : 日期格式() : Set_業務佣金清單() End Sub Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox2.SelectedIndexChanged Set_業務佣金清單() End Sub Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click For i As Integer = 0 To DataGridView1.Rows.Count - 1 If TextBox3.Text = DataGridView1.Rows(i).Cells("單據編號").Value.ToString Then DataGridView1.Rows(i).Cells("選擇").Value = True End If Next i End Sub Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click For i As Integer = 0 To DataGridView1.Rows.Count - 1 : DataGridView1.Rows(i).Cells("選擇").Value = True : Next i End Sub Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click For i As Integer = 0 To DataGridView1.Rows.Count - 1 : DataGridView1.Rows(i).Cells("選擇").Value = False : Next i End Sub Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click For i As Integer = 0 To DataGridView1.Rows.Count - 1 If TextBox3.Text = DataGridView1.Rows(i).Cells("單據編號").Value.ToString Then DataGridView1.Rows(i).Cells("已立帳").Value = False End If Next i End Sub Private Sub Set_日期格式轉換() If CheckBox1.Checked = False Then : DTP = Strings.Format(Today(), "yyyy/MM/dd") : DTP1 = Strings.Format(Today(), "yyyyMMdd") Else : DTP1 = Strings.Format(DateTimePicker3.Value, "yyyyMMdd") : DTP = Strings.Format(DateTimePicker3.Value, "yyyy/MM/dd") : End If End Sub Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click Dim 確認 As Boolean = False If ComboBox6.Text = "" Then : MsgBox("請選擇會計科目。") Else For i As Integer = 0 To DataGridView1.Rows.Count - 1 If DataGridView1.Rows(i).Cells("選擇").Value = True Then 確認 = True : Exit For End If Next If 確認 = False Then : MsgBox("沒有選擇任何一筆要轉收支帳的佣金明細。") Else Dim NUM1 As Integer : Set_日期格式轉換() For ii As Integer = 1 To 999 NUM1 = 0 + ii If NUM1 < 10 Then : TextBox2.Text = "OE-" & DTP1 & "-00" & NUM1 ElseIf NUM1 > 9 And NUM1 < 100 Then : TextBox2.Text = "OE-" & DTP1 & "-0" & NUM1 ElseIf NUM1 > 99 Then : TextBox2.Text = "OE-" & DTP1 & "-" & NUM1 : End If : PA = TextBox2.Text SQL_營運成本收支單申請_支付單號流水號() If dr.Read() Then : Else : ii = 999 : End If Next SQL_營運成本控制表新增() For i As Integer = 0 To DataGridView1.Rows.Count - 1 資料數 = DataGridView1.Rows.Count : MyModule1.進度條() If DataGridView1.Rows(i).Cells("已立帳").Value = False Then If DataGridView1.Rows(i).Cells("選擇").Value = True Then SQL_營運成本明細表項次新增查詢() If dr.Read() Then : 新項次 = dr("項次") : Else : 新項次 = "00" : End If : conn.Close() : NUM1 = Double.Parse(新項次) + 1 If NUM1 < 10 Then : 新項次 = "0" & NUM1 ElseIf NUM1 > 9 And NUM1 < 100 Then : 新項次 = NUM1 : End If PA1 = TextBox2.Text : PA2 = 新項次 : PA3 = ComboBox6.Text : PA6 = DataGridView1.Rows(i).Cells("資料流水號").Value PA4 = DataGridView1.Rows(i).Cells("簡稱").Value & "-" & DataGridView1.Rows(i).Cells("品名").Value & "-" & DataGridView1.Rows(i).Cells("業務").Value & "業務佣金" NU1 = DataGridView1.Rows(i).Cells("佣金").Value : PA5 = "" : NU2 = 0 : NU3 = 0 : NU4 = 0 : PA6 = "付現" : PA7 = gUserName SQL_營運成本明細表新增() : SQL_業務佣金計算表_轉立收支單修改() End If End If Next i : MAOJI_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0 MsgBox("財務收支單(傳票)申請完成,請通知主管審核。") : Set_業務佣金清單() End If End If End Sub Private Sub 列印() N1 = 0 xlSheet.Cells(1, 1) = DateTimePicker1.Value & " 到 " & DateTimePicker2.Value & " " & ComboBox2.Text & " 業務佣金費用" xlSheet.Cells(2, 1) = "單據編號" : xlSheet.Cells(2, 2) = "出貨日期" : xlSheet.Cells(2, 3) = "客戶" : xlSheet.Cells(2, 4) = "品名" : xlSheet.Cells(2, 5) = "售價" xlSheet.Cells(2, 6) = "數量" : xlSheet.Cells(2, 7) = "比例" : xlSheet.Cells(2, 8) = "佣金" For i As Integer = 0 To DataGridView1.Rows.Count - 1 xlSheet.Cells(i + 3, 1) = DataGridView1.Rows(i).Cells("單據編號").Value : xlSheet.Cells(i + 3, 2) = DataGridView1.Rows(i).Cells("出貨日期").Value xlSheet.Cells(i + 3, 3) = DataGridView1.Rows(i).Cells("簡稱").Value : xlSheet.Cells(i + 3, 4) = DataGridView1.Rows(i).Cells("品名").Value xlSheet.Cells(i + 3, 5) = DataGridView1.Rows(i).Cells("售價").Value : xlSheet.Cells(i + 3, 6) = DataGridView1.Rows(i).Cells("數量").Value xlSheet.Cells(i + 3, 7) = DataGridView1.Rows(i).Cells("比例").Value : xlSheet.Cells(i + 3, 8) = DataGridView1.Rows(i).Cells("佣金").Value N1 = i + 3 Next xlSheet.Cells(N1 + 2, 7) = "合計" : xlSheet.Cells(N1 + 2, 8) = "=SUM(H3:H" & N1 & ")" End Sub Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click ComboBox2下拉表單資料載入() xlApp = CType(CreateObject("Excel.Application"), Application) xlBook = xlApp.Workbooks.Add xlApp.DisplayAlerts = True xlApp.Visible = True xlApp.Application.WindowState = xlMaximized For i As Integer = 1 To ComboBox2.Items.Count - 1 ComboBox2.SelectedIndex = i If DataGridView1.Rows.Count = 0 Then : Else xlSheet = NewMethod(xlBook) : xlApp.Sheets(1).Name = ComboBox2.Text : 列印() : AA(xlApp, xlSheet) End If Next xlSheet.PageSetup.PrintArea = "" xlApp.Cells.Select() xlSheet.Range("B1").Select() xlApp.Application.WindowState = xlMinimized xlSheet.Cells.Select() MsgBox("列印完成。") End Sub Private Shared Function NewMethod(xlBook As Workbook) As Worksheet Return CType(xlBook.Worksheets.Add, Worksheet) End Function Private Sub AA(ByVal myExcel As Application, ByVal xlSheet As Worksheet) xlSheet.Cells.Select() With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 25 xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 17 With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 9 With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 9 With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With xlSheet.Columns("D:D").Select : myExcel.Selection.ColumnWidth = 35 xlSheet.Columns("E:F").Select : myExcel.Selection.NumberFormatLocal = "#,##0_ ;[紅色]-#,##0 " With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With xlSheet.Columns("G:G").Select : myExcel.Selection.ColumnWidth = 6 xlSheet.Columns("F:F").Select : myExcel.Selection.ColumnWidth = 6 xlSheet.Columns("E:E").Select : myExcel.Selection.ColumnWidth = 10 xlSheet.Columns("G:G").Select : myExcel.Selection.NumberFormatLocal = "#,##0.0_ ;[紅色]-#,##0.0 " xlSheet.Columns("H:H").Select : myExcel.Selection.ColumnWidth = 12 : myExcel.Selection.NumberFormatLocal = "#,##0_ ;[紅色]-#,##0 " xlSheet.Range("A1:H1").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge xlSheet.Range("A1:H" & N1 & "").Select() myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With myExcel.ActiveWindow.DisplayGridlines = False xlSheet.Rows("3:3").Select : myExcel.ActiveWindow.FreezePanes = True xlSheet.Rows("2:2").Select : myExcel.Selection.RowHeight = 25 With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlTop : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.AutoFilter End Sub '-----------------------------滑鼠右鍵------------------------------------------------------------------------------------------------------------------------------------------ Private Sub 重新整理ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 重新整理ToolStripMenuItem.Click ComboBox1下拉表單資料載入() : ComboBox3下拉表單資料載入() : ComboBox6下拉表單資料載入() : ComboBox2下拉表單資料載入() : ComboBox2.SelectedIndex = 0 : 日期格式() : Set_業務佣金清單() End Sub Private Sub 依據單號全部選擇ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 依據單號全部選擇ToolStripMenuItem.Click Me.Button3.PerformClick() End Sub Private Sub 依據單號取消立帳ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 依據單號取消立帳ToolStripMenuItem.Click Me.Button6.PerformClick() End Sub Private Sub 全部選擇ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 全部選擇ToolStripMenuItem.Click Me.Button13.PerformClick() End Sub Private Sub 全部取消ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 全部取消ToolStripMenuItem.Click Me.Button12.PerformClick() End Sub Private Sub 列印成EXCELToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 列印成EXCELToolStripMenuItem.Click Me.Button5.PerformClick() End Sub Private Sub 開立收支單ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 開立收支單ToolStripMenuItem.Click Me.Button4.PerformClick() End Sub End Class