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 ds1, ds2, ds6, ds7, ds8, ds9, ds10, ds11, ds15 As New DataSet Dim ESTR As String Dim EDR As Integer = 0 Dim xlApp As Application : Dim xlBook As Workbook : Dim xlSheet As Worksheet Dim OldX, OldY As Long Dim drag, 放大 As Boolean Private Sub Set_合約清單() 合約_dgv.DataSource = Nothing : ds6.Clear() 合約_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing 合約_dgv.ColumnHeadersHeight = 25 : 合約_dgv.AllowUserToAddRows = False PA46 = 合約編號1_cb.Text : PA47 = 工程期1_ch.Text SQL_合約清單_請款用() da.Fill(ds6) : 合約_dgv.DataSource = ds6.Tables(0) : conn.Close() 合約_dgv.Columns(0).FillWeight = 160 : 合約_dgv.Columns(1).Visible = False : 合約_dgv.Columns(2).Visible = False : 合約_dgv.Columns(3).Visible = False 合約_dgv.Columns(4).Visible = False : 合約_dgv.Columns(5).Visible = False : 合約_dgv.Columns(6).Visible = False : 合約_dgv.Columns(7).Visible = False 合約_dgv.Columns(8).Visible = False : 合約_dgv.Columns(9).Visible = False : 合約_dgv.Columns(10).Visible = False : 合約_dgv.Columns(11).Visible = False 合約_dgv.Columns(12).Visible = False : 合約_dgv.Columns(13).Visible = False : 合約_dgv.Columns(14).Visible = False : 合約_dgv.Columns(15).Visible = False 合約_dgv.Columns(16).Visible = False : 合約_dgv.Columns(17).Visible = False : 合約_dgv.Columns(18).Visible = False : 合約_dgv.Columns(19).Visible = False 合約_dgv.Columns(20).Visible = False : 合約_dgv.Columns(21).Visible = False : 合約_dgv.Columns(22).Visible = False : 合約_dgv.Columns(23).Visible = False 合約_dgv.Columns(24).FillWeight = 100 : 合約_dgv.Columns(25).Visible = False : 合約_dgv.Columns(26).Visible = False : 合約_dgv.Columns(27).Visible = False 合約_dgv.Columns(28).Visible = False : 合約_dgv.Columns(29).Visible = False : 合約_dgv.Columns(30).Visible = False : 合約_dgv.Columns("工程名稱_中").FillWeight = 300 If 放大 = True Then 合約_dgv.Columns("工程名稱_中").Visible = True Else 合約_dgv.Columns("工程名稱_中").Visible = False End If End Sub Private Sub Set_附錄清單() 合約附錄_dgv.DataSource = Nothing : ds1.Clear() 合約附錄_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing 合約附錄_dgv.ColumnHeadersHeight = 25 : 合約附錄_dgv.AllowUserToAddRows = False SQL_附錄合約_清單查詢1() da.Fill(ds1) : 合約附錄_dgv.DataSource = ds1.Tables(0) : conn.Close() 合約附錄_dgv.Columns(0).Visible = False : 合約附錄_dgv.Columns(1).FillWeight = 160 : 合約附錄_dgv.Columns(2).Visible = False : 合約附錄_dgv.Columns(3).Visible = False 合約附錄_dgv.Columns(4).Visible = False : 合約附錄_dgv.Columns(5).Visible = False : 合約附錄_dgv.Columns(6).Visible = False : 合約附錄_dgv.Columns(7).FillWeight = 70 End Sub Private Sub Set_合約報價總表() 報價總表_dgv.DataSource = Nothing : ds15.Clear() 報價總表_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing 報價總表_dgv.ColumnHeadersHeight = 40 : 報價總表_dgv.AllowUserToAddRows = False : 報價總表_dgv.RowTemplate.Height = 45 報價總表_dgv.RowsDefaultCellStyle.WrapMode = DataGridViewTriState.True SQL_合約報價總表() da.Fill(ds15) : 報價總表_dgv.DataSource = ds15.Tables(0) : conn.Close() 報價總表_dgv.Columns(0).Visible = False : 報價總表_dgv.Columns(8).Visible = False : 報價總表_dgv.Columns(9).Visible = False 報價總表_dgv.Columns(0).FillWeight = 50 : 報價總表_dgv.Columns(1).FillWeight = 50 : 報價總表_dgv.Columns(2).FillWeight = 210 報價總表_dgv.Columns(3).FillWeight = 50 : 報價總表_dgv.Columns(4).FillWeight = 50 : 報價總表_dgv.Columns(5).FillWeight = 80 報價總表_dgv.Columns(6).FillWeight = 80 : 報價總表_dgv.Columns(7).FillWeight = 90 For i As Integer = 4 To 6 : 報價總表_dgv.Columns(i).DefaultCellStyle.Format = "#,##0" : Next For i As Integer = 4 To 6 : 報價總表_dgv.Columns(i).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : Next For i As Integer = 0 To 7 : 報價總表_dgv.Columns(i).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter : Next 報價總表_dgv.Columns(1).ReadOnly = True : 報價總表_dgv.Columns(2).ReadOnly = True : 報價總表_dgv.Columns(6).ReadOnly = True 報價總表_dgv.EditMode = DataGridViewEditMode.EditOnEnter End Sub Private Sub Set_請款清單() 請款單_dgv.DataSource = Nothing : ds2.Clear() 請款單_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing 請款單_dgv.ColumnHeadersHeight = 25 : 請款單_dgv.AllowUserToAddRows = False SQL_請款單_清單查詢() da.Fill(ds2) : 請款單_dgv.DataSource = ds2.Tables(0) : conn.Close() 請款單_dgv.Columns(0).Visible = False : 請款單_dgv.Columns(1).FillWeight = 50 : 請款單_dgv.Columns(2).Visible = False : 請款單_dgv.Columns(3).FillWeight = 50 請款單_dgv.Columns(4).FillWeight = 100 : 請款單_dgv.Columns(5).FillWeight = 50 : 請款單_dgv.Columns(6).Visible = False : 請款單_dgv.Columns(7).Visible = False 請款單_dgv.Columns(8).FillWeight = 100 : 請款單_dgv.Columns(9).FillWeight = 80 請款單_dgv.Columns(3).DefaultCellStyle.Format = "#,##0" : 請款單_dgv.Columns(4).DefaultCellStyle.Format = "#,##0" 請款單_dgv.Columns(5).DefaultCellStyle.Format = "#,##0" : 請款單_dgv.Columns(8).DefaultCellStyle.Format = "#,##0" 請款單_dgv.Columns(3).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight 請款單_dgv.Columns(4).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight 請款單_dgv.Columns(5).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight 請款單_dgv.Columns(8).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight End Sub Private Sub Set_合約明細1() 第1期_dgv.DataSource = Nothing : ds7.Clear() 第1期_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing 第1期_dgv.ColumnHeadersHeight = 25 : 第1期_dgv.AllowUserToAddRows = False SQL_合約明細讀取() da.Fill(ds7) : 第1期_dgv.DataSource = ds7.Tables(0) : conn.Close() 第1期_dgv.Columns(0).Visible = False : 第1期_dgv.Columns(1).Visible = False : 第1期_dgv.Columns(2).FillWeight = 20 : 第1期_dgv.Columns(3).FillWeight = 140 第1期_dgv.Columns(4).FillWeight = 20 : 第1期_dgv.Columns(5).FillWeight = 50 第1期_dgv.Columns(2).ReadOnly = True : 第1期_dgv.Columns(5).ReadOnly = True 第1期_dgv.EditMode = DataGridViewEditMode.EditOnEnter 第1期_dgv.Columns(2).DefaultCellStyle.Format = "#,##0" : 第1期_dgv.Columns(4).DefaultCellStyle.Format = "#,##0.00" : 第1期_dgv.Columns(5).DefaultCellStyle.Format = "#,##0" 第1期_dgv.Columns(4).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : 第1期_dgv.Columns(5).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight End Sub Private Sub Set_合約明細2() 第2期_dgv.DataSource = Nothing : ds8.Clear() 第2期_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing 第2期_dgv.ColumnHeadersHeight = 25 : 第2期_dgv.AllowUserToAddRows = False SQL_合約明細讀取() da.Fill(ds8) : 第2期_dgv.DataSource = ds8.Tables(0) : conn.Close() 第2期_dgv.Columns(0).Visible = False : 第2期_dgv.Columns(1).Visible = False : 第2期_dgv.Columns(2).FillWeight = 20 : 第2期_dgv.Columns(3).FillWeight = 140 第2期_dgv.Columns(4).FillWeight = 20 : 第2期_dgv.Columns(5).FillWeight = 50 第2期_dgv.Columns(2).ReadOnly = True : 第2期_dgv.Columns(5).ReadOnly = True 第2期_dgv.EditMode = DataGridViewEditMode.EditOnEnter 第2期_dgv.Columns(2).DefaultCellStyle.Format = "#,##0" : 第2期_dgv.Columns(4).DefaultCellStyle.Format = "#,##0.00" : 第2期_dgv.Columns(5).DefaultCellStyle.Format = "#,##0" 第2期_dgv.Columns(4).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : 第2期_dgv.Columns(5).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight End Sub Private Sub Set_合約明細3() 第3期_dgv.DataSource = Nothing : ds9.Clear() 第3期_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing 第3期_dgv.ColumnHeadersHeight = 25 第3期_dgv.AllowUserToAddRows = False SQL_合約明細讀取() da.Fill(ds9) : 第3期_dgv.DataSource = ds9.Tables(0) : conn.Close() 第3期_dgv.Columns(0).Visible = False : 第3期_dgv.Columns(1).Visible = False : 第3期_dgv.Columns(2).FillWeight = 20 : 第3期_dgv.Columns(3).FillWeight = 140 第3期_dgv.Columns(4).FillWeight = 20 : 第3期_dgv.Columns(5).FillWeight = 50 第3期_dgv.Columns(2).ReadOnly = True : 第3期_dgv.Columns(5).ReadOnly = True 第3期_dgv.EditMode = DataGridViewEditMode.EditOnEnter 第3期_dgv.Columns(2).DefaultCellStyle.Format = "#,##0" : 第3期_dgv.Columns(4).DefaultCellStyle.Format = "#,##0.00" : 第3期_dgv.Columns(5).DefaultCellStyle.Format = "#,##0" 第3期_dgv.Columns(4).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : 第3期_dgv.Columns(5).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight End Sub Private Sub Set_合約明細4() 第4期_dgv.DataSource = Nothing : ds10.Clear() 第4期_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing 第4期_dgv.ColumnHeadersHeight = 25 : 第4期_dgv.AllowUserToAddRows = False SQL_合約明細讀取() da.Fill(ds10) : 第4期_dgv.DataSource = ds10.Tables(0) : conn.Close() 第4期_dgv.Columns(0).Visible = False : 第4期_dgv.Columns(1).Visible = False : 第4期_dgv.Columns(2).FillWeight = 20 : 第4期_dgv.Columns(3).FillWeight = 140 第4期_dgv.Columns(4).FillWeight = 20 : 第4期_dgv.Columns(5).FillWeight = 50 第4期_dgv.Columns(2).ReadOnly = True : 第4期_dgv.Columns(5).ReadOnly = True 第4期_dgv.EditMode = DataGridViewEditMode.EditOnEnter 第4期_dgv.Columns(2).DefaultCellStyle.Format = "#,##0" : 第4期_dgv.Columns(4).DefaultCellStyle.Format = "#,##0.00" : 第4期_dgv.Columns(5).DefaultCellStyle.Format = "#,##0" 第4期_dgv.Columns(4).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : 第4期_dgv.Columns(5).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight End Sub Private Sub Set_合約明細5() 第5期_dgv.DataSource = Nothing : ds11.Clear() 第5期_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing 第5期_dgv.ColumnHeadersHeight = 25 : 第5期_dgv.AllowUserToAddRows = False SQL_合約明細讀取() da.Fill(ds11) : 第5期_dgv.DataSource = ds11.Tables(0) : conn.Close() 第5期_dgv.Columns(0).Visible = False : 第5期_dgv.Columns(1).Visible = False : 第5期_dgv.Columns(2).FillWeight = 20 : 第5期_dgv.Columns(3).FillWeight = 140 第5期_dgv.Columns(4).FillWeight = 20 : 第5期_dgv.Columns(5).FillWeight = 50 第5期_dgv.Columns(2).ReadOnly = True : 第5期_dgv.Columns(5).ReadOnly = True 第5期_dgv.Columns(2).DefaultCellStyle.Format = "#,##0" : 第5期_dgv.Columns(4).DefaultCellStyle.Format = "#,##0.00" : 第5期_dgv.Columns(5).DefaultCellStyle.Format = "#,##0" 第5期_dgv.Columns(4).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : 第5期_dgv.Columns(5).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight End Sub Private Sub 甲方條件下拉清單讀取() SQL合約條件讀取() : 合約編號1_cb.Items.Clear() : 合約編號1_cb.Items.Add("") : While (dr.Read()) : 合約編號1_cb.Items.Add(dr("約號甲方")) : End While : conn.Close() End Sub Private Sub 合約請款單_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.MdiParent = HX_PGS_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True 工程款1_nud.Value = 30 : 工程款2_nud.Value = 40 : 工程款3_nud.Value = 20 : 工程款4_nud.Value = 5 : 工程款5_nud.Value = 5 : 視窗2_pl.Visible = False : 報告移交單_ch.Enabled = False SOP3_P.Image = My.Resources._1_124 : SOP4_P.Image = My.Resources._1_124 : SOP5_P.Image = My.Resources._1_124 : SOP6_P.Image = My.Resources._1_124 : SOP7_P.Image = My.Resources._1_124 SOP3_P.SizeMode = 4 : SOP4_P.SizeMode = 4 : SOP5_P.SizeMode = 4 : SOP6_P.SizeMode = 4 : SOP7_P.SizeMode = 4 甲方條件下拉清單讀取() : Set_合約清單() : 合約報價單_Siz() End Sub Private Sub 合約請款單_Closed(sender As Object, e As EventArgs) Handles MyBase.Closed MyModule1.虛擬桌面開啟() End Sub Private Sub 合約報價單_Siz() MyModule1.清單字體大小調整() 合約_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", 7.6) 合約附錄_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value) 請款單_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value) 第1期_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value) 第2期_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value) 第3期_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value) 第4期_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value) 第5期_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value) End Sub Private Sub 登入閒置控制_MouseMove(sender As Object, e As EventArgs) Handles MyBase.MouseMove timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True End Sub Private Sub 登入閒置控制_KeyPress(sender As Object, e As EventArgs) Handles MyBase.KeyPress timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True End Sub Private Sub 請款計算() BNUD1.Value = 金額1_und.Value : BNUD2.Value = 金額2_und.Value : BNUD3.Value = 金額3_und.Value : BNUD4.Value = 金額4_und.Value : BNUD5.Value = 金額5_und.Value ANUD4.Value = 0 : For i As Integer = 0 To 請款單_dgv.Rows.Count - 1 : ANUD4.Value += 請款單_dgv("請款總額", i).Value.ToString : Next ANUD1.Value = NUD3.Value : ANUD3.Value = NUD5.Value : ANUD2.Value = ANUD1.Value + ANUD3.Value : ANUD5.Value = ANUD2.Value - ANUD4.Value '----收款累加--------------- Dim 已收款 As Long = 0 For DD As Integer = 0 To 1 For i As Integer = 0 To 請款單_dgv.Rows.Count - 1 : 已收款 += 請款單_dgv("請款總額", i).Value : Next If 已收款 = 0 Then : Else If 已收款 = BNUD1.Value Then : BNUD1.Value = 0 : Exit For : ElseIf 已收款 < BNUD1.Value Then : BNUD1.Value = BNUD1.Value - 已收款 : Exit For ElseIf 已收款 > BNUD1.Value Then : 已收款 -= BNUD1.Value : BNUD1.Value = 0 : End If If 已收款 = BNUD2.Value Then : BNUD2.Value = 0 : Exit For : ElseIf 已收款 < BNUD2.Value Then : BNUD2.Value = BNUD2.Value - 已收款 : Exit For ElseIf 已收款 > BNUD2.Value Then : 已收款 -= BNUD2.Value : BNUD2.Value = 0 : End If If 已收款 = BNUD3.Value Then : BNUD3.Value = 0 : Exit For : ElseIf 已收款 < BNUD3.Value Then : BNUD3.Value = BNUD3.Value - 已收款 : Exit For ElseIf 已收款 > BNUD3.Value Then : 已收款 -= BNUD3.Value : BNUD3.Value = 0 : End If If 已收款 = BNUD4.Value Then : BNUD4.Value = 0 : Exit For : ElseIf 已收款 < BNUD4.Value Then : BNUD4.Value = BNUD4.Value - 已收款 : Exit For ElseIf 已收款 > BNUD4.Value Then : 已收款 -= BNUD4.Value : BNUD4.Value = 0 : End If If 已收款 = BNUD5.Value Then : BNUD5.Value = 0 : Exit For : ElseIf 已收款 < BNUD5.Value Then : BNUD5.Value = BNUD5.Value - 已收款 : Exit For ElseIf 已收款 > BNUD5.Value Then : BNUD5.Value = 0 : End If End If Next 'My.Resources._1_123 綠色 My.Resources._1_124 紅色 My.Resources._1_125 橘色 If 工程款1_nud.Value > 0 And BNUD1.Value > 0 Then : SOP3_P.Image = My.Resources._1_125 : ElseIf 工程款1_nud.Value > 0 And BNUD1.Value = 0 Then : SOP3_P.Image = My.Resources._1_123 ElseIf 工程款1_nud.Value = 0 And BNUD1.Value = 0 Then : SOP3_P.Image = My.Resources._1_124 : End If : SOP3_P.SizeMode = 4 If 工程款2_nud.Value > 0 And BNUD2.Value > 0 Then : SOP4_P.Image = My.Resources._1_125 : ElseIf 工程款2_nud.Value > 0 And BNUD2.Value = 0 Then : SOP4_P.Image = My.Resources._1_123 ElseIf 工程款2_nud.Value = 0 And BNUD2.Value = 0 Then : SOP4_P.Image = My.Resources._1_124 : End If : SOP4_P.SizeMode = 4 If 工程款3_nud.Value > 0 And BNUD3.Value > 0 Then : SOP5_P.Image = My.Resources._1_125 : ElseIf 工程款3_nud.Value > 0 And BNUD3.Value = 0 Then : SOP5_P.Image = My.Resources._1_123 ElseIf 工程款3_nud.Value = 0 And BNUD3.Value = 0 Then : SOP5_P.Image = My.Resources._1_124 : End If : SOP5_P.SizeMode = 4 If 工程款4_nud.Value > 0 And BNUD4.Value > 0 Then : SOP6_P.Image = My.Resources._1_125 : ElseIf 工程款4_nud.Value > 0 And BNUD4.Value = 0 Then : SOP6_P.Image = My.Resources._1_123 ElseIf 工程款4_nud.Value = 0 And BNUD4.Value = 0 Then : SOP6_P.Image = My.Resources._1_124 : End If : SOP6_P.SizeMode = 4 If 工程款5_nud.Value > 0 And BNUD5.Value > 0 Then : SOP7_P.Image = My.Resources._1_125 : ElseIf 工程款5_nud.Value > 0 And BNUD5.Value = 0 Then : SOP7_P.Image = My.Resources._1_123 ElseIf 工程款5_nud.Value = 0 And BNUD5.Value = 0 Then : SOP7_P.Image = My.Resources._1_124 : End If : SOP7_P.SizeMode = 4 PA = 合約編號_tb.Text : PA1 = ANUD3.Value : PA2 = ANUD2.Value : PA3 = ANUD4.Value : PA4 = ANUD5.Value : PA5 = BNUD1.Value : PA6 = BNUD2.Value PA7 = BNUD3.Value : PA8 = BNUD4.Value : PA9 = BNUD5.Value : SQL_控制表_請款修改() End Sub Private Sub 合約_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 合約_dgv.CellClick If e.RowIndex = -1 Then : Else 請款單號_tb.Text = "" : 請款期數_cb.Text = "" : 比例_nud.Value = 0 : 稅金_nud.Value = 0 : 請款金額_nud.Value = 0 : 請款總額_nud.Value = 0 : 付款期限_cb.Text = "" 報告移交計算() If 放大 = True Then : 縮放2_bt.PerformClick() : End If : 合約編號_tb.Text = 合約_dgv("合約編號", e.RowIndex).Value.ToString : PA = 合約編號_tb.Text : Set_合約報價總表() If 報價總表_dgv.Rows.Count > 0 Then For i As Integer = 0 To 報價總表_dgv.Rows.Count - 1 If 報價總表_dgv.Rows(i).Cells("DESCRIPTION").Value.ToString = "稅金 10% Tax" Then : 稅額顯示_lb.Text = "PPN 10%稅額 = Rp. " ElseIf 報價總表_dgv.Rows(i).Cells("DESCRIPTION").Value.ToString = "稅金 11% Tax" Then : 稅額顯示_lb.Text = "PPN 11%稅額 = Rp. " : End If If 報價總表_dgv.Rows(i).Cells("DESCRIPTION").Value.ToString = "總計 Grand Total" Then : NUD3.Value = 報價總表_dgv.Rows(i).Cells("AMOUNT (RP)").Value : End If Next Else : 稅額顯示_lb.Text = "PPN 10%稅額 = Rp. " : End If B09_tb.Text = 合約_dgv("客戶地址", e.RowIndex).Value.ToString() : B24_tb.Text = "" : B25_tb.Text = "" : B26_tb.Text = "" If 合約_dgv("驗收完成日期", e.RowIndex).Value.ToString() <> "" Then DTP1.Value = 合約_dgv("驗收完成日期", e.RowIndex).Value.ToString() : B44_tb.Text = 合約_dgv.Rows(e.RowIndex).Cells("保固期限").Value.ToString Dim 保固日 As String = Strings.Format(DTP1.Value.AddMonths(CInt(合約_dgv.Rows(e.RowIndex).Cells("保固期限").Value.ToString))) B24_tb.Text = Strings.Right(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 2) B26_tb.Text = Strings.Left(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 4) If Strings.Mid(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 6, 2) = "01" Then : B25_tb.Text = "Jan" ElseIf Strings.Mid(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 6, 2) = "02" Then : B25_tb.Text = "Feb" ElseIf Strings.Mid(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 6, 2) = "03" Then : B25_tb.Text = "Ber" ElseIf Strings.Mid(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 6, 2) = "04" Then : B25_tb.Text = "Apr" ElseIf Strings.Mid(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 6, 2) = "05" Then : B25_tb.Text = "Mun" ElseIf Strings.Mid(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 6, 2) = "06" Then : B25_tb.Text = "Jun" ElseIf Strings.Mid(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 6, 2) = "07" Then : B25_tb.Text = "Jul" ElseIf Strings.Mid(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 6, 2) = "08" Then : B25_tb.Text = "Agu" ElseIf Strings.Mid(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 6, 2) = "09" Then : B25_tb.Text = "Sep" ElseIf Strings.Mid(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 6, 2) = "10" Then : B25_tb.Text = "Okt" ElseIf Strings.Mid(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 6, 2) = "11" Then : B25_tb.Text = "Nov" ElseIf Strings.Mid(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 6, 2) = "12" Then : B25_tb.Text = "Des" : End If B27_tb.Text = Strings.Right(保固日, 2) : B29_tb.Text = Strings.Left(保固日, 4) If Strings.Mid(保固日, 6, 2) = "01" Then : B28_tb.Text = "Jan" : ElseIf Strings.Mid(保固日, 6, 2) = "02" Then : B28_tb.Text = "Feb" ElseIf Strings.Mid(保固日, 6, 2) = "03" Then : B28_tb.Text = "Ber" : ElseIf Strings.Mid(保固日, 6, 2) = "04" Then : B28_tb.Text = "Apr" ElseIf Strings.Mid(保固日, 6, 2) = "05" Then : B28_tb.Text = "Mun" : ElseIf Strings.Mid(保固日, 6, 2) = "06" Then : B28_tb.Text = "Jun" ElseIf Strings.Mid(保固日, 6, 2) = "07" Then : B28_tb.Text = "Jul" : ElseIf Strings.Mid(保固日, 6, 2) = "08" Then : B28_tb.Text = "Agu" ElseIf Strings.Mid(保固日, 6, 2) = "09" Then : B28_tb.Text = "Sep" : ElseIf Strings.Mid(保固日, 6, 2) = "10" Then : B28_tb.Text = "Okt" ElseIf Strings.Mid(保固日, 6, 2) = "11" Then : B28_tb.Text = "Nov" : ElseIf Strings.Mid(保固日, 6, 2) = "12" Then : B28_tb.Text = "Des" : End If End If 甲方_tb.Text = 合約_dgv("約號甲方", e.RowIndex).Value.ToString 客戶名稱_tb.Text = 合約_dgv("客戶名稱", e.RowIndex).Value.ToString : 工程名稱_英_tb.Text = 合約_dgv("工程名稱_英", e.RowIndex).Value.ToString 工程名稱_中_tb.Text = 合約_dgv("工程名稱_中", e.RowIndex).Value.ToString : 工程款1_nud.Value = 合約_dgv("第一期比例", e.RowIndex).Value 工程款2_nud.Value = 合約_dgv("第二期比例", e.RowIndex).Value : 工程款3_nud.Value = 合約_dgv("第三期比例", e.RowIndex).Value 工程款4_nud.Value = 合約_dgv("第四期比例", e.RowIndex).Value : 工程款5_nud.Value = 合約_dgv("第五期比例", e.RowIndex).Value CH2.Checked = True : NUD3.Value = 合約_dgv("工程總價", e.RowIndex).Value NUD3.Value = 合約_dgv("工程總價", e.RowIndex).Value : NUD6.Value = 0 PA1 = "1" : Set_合約明細1() : PA1 = "2" : Set_合約明細2() : PA1 = "3" : Set_合約明細3() : PA1 = "4" : Set_合約明細4() : PA1 = "5" : Set_合約明細5() Set_附錄清單() If 合約附錄_dgv.Rows.Count > 0 Then NUD4.Value = 合約附錄_dgv("原金額", 0).Value : NUD5.Value = 合約附錄_dgv("追加減", 0).Value : 附錄編號_tb.Text = 合約附錄_dgv("附錄編號", 0).Value.ToString Else : NUD4.Value = 0 : NUD5.Value = 0 : 附錄編號_tb.Text = "" : End If Set_請款清單() : 請款計算() : NUD3.Value += 1 : NUD3.Value -= 1 End If End Sub Private Sub 合約附錄_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 合約附錄_dgv.CellClick NUD4.Value = 合約附錄_dgv("原金額", e.RowIndex).Value : NUD5.Value = 合約附錄_dgv("追加減", e.RowIndex).Value 附錄編號_tb.Text = 合約附錄_dgv("附錄編號", e.RowIndex).Value.ToString : 請款計算() End Sub Private Sub 請款單_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 請款單_dgv.CellClick 請款單號_tb.Text = 請款單_dgv("請款編號", e.RowIndex).Value.ToString : 請款期數_cb.Text = 請款單_dgv("期數", e.RowIndex).Value.ToString 請款內容_tb.Text = 請款單_dgv("請款內容", e.RowIndex).Value.ToString : 比例_nud.Value = 請款單_dgv("比例", e.RowIndex).Value 請款金額_nud.Value = 請款單_dgv("請款金額", e.RowIndex).Value : 稅金_nud.Value = 請款單_dgv("稅金", e.RowIndex).Value 付款期限_cb.Text = 請款單_dgv("付款期限", e.RowIndex).Value.ToString : 申請日期_dtp.Value = 請款單_dgv("申請時間", e.RowIndex).Value 其他意見_tb.Text = 請款單_dgv("審批意見", e.RowIndex).Value.ToString : 請款總額_nud.Value = 請款單_dgv("請款總額", e.RowIndex).Value 報告移交計算() End Sub Private Sub 第1期_dgv_CellContentCl(sender As Object, e As DataGridViewCellEventArgs) Handles 第1期_dgv.CellEnter If Not IsNumeric(第1期_dgv.Rows(e.RowIndex).Cells("比例").Value) Then If 系統語言 = "繁體中文" Then : MsgBox("欄位輸入必須為數值!!") : Else : MsgBox("Input bidang harus numerik!!") : End If 第1期_dgv.Rows(e.RowIndex).Cells("比例").Value = "0" : 第1期_dgv.Rows(e.RowIndex).Cells("金額").Value = "0" Else Dim nn As Integer For i As Integer = 0 To 第1期_dgv.Rows.Count - 1 : nn += 第1期_dgv.Rows(i).Cells("比例").Value : Next If nn > 工程款1_nud.Value Then Dim SS As String If 系統語言 = "繁體中文" Then : SS = "第一期的細項比例不可大於 " : Else : SS = "Proporsi detail fase pertama tidak boleh lebih dari " : End If MsgBox(SS & Strings.Format(工程款1_nud.Value, "#,##0.00") & " % !!") 第1期_dgv.Rows(e.RowIndex).Cells("比例").Value = "0" : 第1期_dgv.Rows(e.RowIndex).Cells("金額").Value = "0" Else For i As Integer = 0 To 第1期_dgv.Rows.Count - 1 第1期_dgv.Rows(i).Cells("金額").Value = 第1期_dgv.Rows(i).Cells("比例").Value * 金額1_und.Value / 工程款1_nud.Value Next i End If End If End Sub Private Sub 第2期_dgv_CellContentCl(sender As Object, e As DataGridViewCellEventArgs) Handles 第2期_dgv.CellEnter If Not IsNumeric(第2期_dgv.Rows(e.RowIndex).Cells("比例").Value) Then If 系統語言 = "繁體中文" Then : MsgBox("欄位輸入必須為數值!!") : Else : MsgBox("Input bidang harus numerik!!") : End If 第2期_dgv.Rows(e.RowIndex).Cells("比例").Value = "0" : 第2期_dgv.Rows(e.RowIndex).Cells("金額").Value = "0" Else Dim nn As Integer For i As Integer = 0 To 第2期_dgv.Rows.Count - 1 : nn += 第2期_dgv.Rows(i).Cells("比例").Value : Next If nn > 工程款2_nud.Value Then Dim SS As String If 系統語言 = "繁體中文" Then : SS = "第二期的細項比例不可大於 " : Else : SS = "Proporsi detail fase kedua tidak boleh lebih besar dari " : End If MsgBox(SS & Strings.Format(工程款2_nud.Value, "#,##0.00") & " % !!") 第2期_dgv.Rows(e.RowIndex).Cells("比例").Value = "0" : 第2期_dgv.Rows(e.RowIndex).Cells("金額").Value = "0" Else For i As Integer = 0 To 第2期_dgv.Rows.Count - 1 第2期_dgv.Rows(i).Cells("金額").Value = 第2期_dgv.Rows(i).Cells("比例").Value * 金額2_und.Value / 工程款2_nud.Value Next i End If End If End Sub Private Sub 第3期_dgv_CellContentCl(sender As Object, e As DataGridViewCellEventArgs) Handles 第3期_dgv.CellEnter If Not IsNumeric(第3期_dgv.Rows(e.RowIndex).Cells("比例").Value) Then If 系統語言 = "繁體中文" Then : MsgBox("欄位輸入必須為數值!!") : Else : MsgBox("Input bidang harus numerik!!") : End If 第3期_dgv.Rows(e.RowIndex).Cells("比例").Value = "0" : 第3期_dgv.Rows(e.RowIndex).Cells("金額").Value = "0" Else Dim nn As Integer For i As Integer = 0 To 第3期_dgv.Rows.Count - 1 : nn += 第3期_dgv.Rows(i).Cells("比例").Value : Next If nn > 工程款3_nud.Value Then Dim SS As String If 系統語言 = "繁體中文" Then : SS = "第三期的細項比例不可大於 " : Else : SS = "Proporsi rincian periode ketiga tidak boleh lebih besar dari " : End If MsgBox(SS & Strings.Format(工程款3_nud.Value, "#,##0.00") & " % !!") 第3期_dgv.Rows(e.RowIndex).Cells("比例").Value = "0" : 第3期_dgv.Rows(e.RowIndex).Cells("金額").Value = "0" Else For i As Integer = 0 To 第3期_dgv.Rows.Count - 1 第3期_dgv.Rows(i).Cells("金額").Value = 第3期_dgv.Rows(i).Cells("比例").Value * 金額3_und.Value / 工程款3_nud.Value Next i End If End If End Sub Private Sub 第4期_dgv_CellContentCl(sender As Object, e As DataGridViewCellEventArgs) Handles 第4期_dgv.CellEnter If Not IsNumeric(第4期_dgv.Rows(e.RowIndex).Cells("比例").Value) Then If 系統語言 = "繁體中文" Then : MsgBox("欄位輸入必須為數值!!") : Else : MsgBox("Input bidang harus numerik!!") : End If 第4期_dgv.Rows(e.RowIndex).Cells("比例").Value = "0" : 第4期_dgv.Rows(e.RowIndex).Cells("金額").Value = "0" Else Dim nn As Integer For i As Integer = 0 To 第4期_dgv.Rows.Count - 1 : nn += 第4期_dgv.Rows(i).Cells("比例").Value : Next If nn > 工程款4_nud.Value Then Dim SS As String If 系統語言 = "繁體中文" Then : SS = "第四期的細項比例不可大於 " : Else : SS = "Proporsi rincian periode ke-4 tidak boleh lebih besar dari " : End If MsgBox(SS & Strings.Format(工程款4_nud.Value, "#,##0.00") & " % !!") 第4期_dgv.Rows(e.RowIndex).Cells("比例").Value = "0" : 第4期_dgv.Rows(e.RowIndex).Cells("金額").Value = "0" Else For i As Integer = 0 To 第4期_dgv.Rows.Count - 1 第4期_dgv.Rows(i).Cells("金額").Value = 第4期_dgv.Rows(i).Cells("比例").Value * 金額4_und.Value / 工程款4_nud.Value Next i End If End If End Sub Private Sub 第5期_dgv_CellContentCl(sender As Object, e As DataGridViewCellEventArgs) Handles 第5期_dgv.CellEnter If Not IsNumeric(第5期_dgv.Rows(e.RowIndex).Cells("比例").Value) Then If 系統語言 = "繁體中文" Then : MsgBox("欄位輸入必須為數值!!") : Else : MsgBox("Input bidang harus numerik!!") : End If 第5期_dgv.Rows(e.RowIndex).Cells("比例").Value = "0" : 第5期_dgv.Rows(e.RowIndex).Cells("金額").Value = "0" Else Dim nn As Integer For i As Integer = 0 To 第5期_dgv.Rows.Count - 1 : nn += 第5期_dgv.Rows(i).Cells("比例").Value : Next If nn > 工程款5_nud.Value Then Dim SS As String If 系統語言 = "繁體中文" Then : SS = "第五期的細項比例不可大於 " : Else : SS = "Proporsi rincian periode kelima tidak boleh lebih besar dari " : End If MsgBox(SS & Strings.Format(工程款5_nud.Value, "#,##0.00") & " % !!") 第5期_dgv.Rows(e.RowIndex).Cells("比例").Value = "0" : 第5期_dgv.Rows(e.RowIndex).Cells("金額").Value = "0" Else For i As Integer = 0 To 第5期_dgv.Rows.Count - 1 第5期_dgv.Rows(i).Cells("金額").Value = 第5期_dgv.Rows(i).Cells("比例").Value * 金額5_und.Value / 工程款5_nud.Value Next i End If End If End Sub Private Sub 第1期_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 第1期_dgv.CellClick If e.RowIndex = -1 Then : Else : 明細選項_bt.Text = 第1期_dgv("細項", e.RowIndex).Value.ToString : 明細選項_bt.Text = Strings.Format(Val(明細選項_bt.Text), "#,##0") : End If End Sub Private Sub 第2期_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 第2期_dgv.CellClick If e.RowIndex = -1 Then : Else : 明細選項_bt.Text = 第2期_dgv("細項", e.RowIndex).Value.ToString : 明細選項_bt.Text = Strings.Format(Val(明細選項_bt.Text), "#,##0") : End If End Sub Private Sub 第3期_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 第3期_dgv.CellClick If e.RowIndex = -1 Then : Else : 明細選項_bt.Text = 第3期_dgv("細項", e.RowIndex).Value.ToString : 明細選項_bt.Text = Strings.Format(Val(明細選項_bt.Text), "#,##0") : End If End Sub Private Sub 第4期_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 第4期_dgv.CellClick If e.RowIndex = -1 Then : Else : 明細選項_bt.Text = 第4期_dgv("細項", e.RowIndex).Value.ToString : 明細選項_bt.Text = Strings.Format(Val(明細選項_bt.Text), "#,##0") : End If End Sub Private Sub 第5期_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 第5期_dgv.CellClick If e.RowIndex = -1 Then : Else : 明細選項_bt.Text = 第5期_dgv("細項", e.RowIndex).Value.ToString : 明細選項_bt.Text = Strings.Format(Val(明細選項_bt.Text), "#,##0") : End If End Sub Private Sub 合約編號1_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 合約編號1_cb.SelectedIndexChanged Set_合約清單() End Sub Private Sub 工程期1_ch_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 工程期1_ch.SelectedIndexChanged Set_合約清單() End Sub Private Sub NUD3_ValueChanged(sender As Object, e As EventArgs) Handles NUD3.ValueChanged If CH2.Checked = True Then If 稅額顯示_lb.Text = "PPN 10%稅額 = Rp. " Then : NUD2.Value = NUD3.Value / 110 * 10 : Else : NUD2.Value = NUD3.Value / 111 * 11 : End If NUD1.Value = NUD3.Value - NUD2.Value 金額1_und.Value = NUD3.Value / 100 * 工程款1_nud.Value : 金額2_und.Value = NUD3.Value / 100 * 工程款2_nud.Value 金額3_und.Value = NUD3.Value / 100 * 工程款3_nud.Value : 金額4_und.Value = NUD3.Value / 100 * 工程款4_nud.Value 金額5_und.Value = NUD3.Value / 100 * 工程款5_nud.Value 金額6_und.Value = 金額1_und.Value + 金額2_und.Value + 金額3_und.Value + 金額4_und.Value + 金額5_und.Value End If End Sub Private Sub NUD1_ValueChanged(sender As Object, e As EventArgs) Handles NUD1.ValueChanged If CH1.Checked = True Then NUD2.Value = NUD1.Value / 100 * 10 : NUD3.Value = NUD1.Value + NUD2.Value 金額1_und.Value = NUD3.Value / 100 * 工程款1_nud.Value : 金額2_und.Value = NUD3.Value / 100 * 工程款2_nud.Value 金額3_und.Value = NUD3.Value / 100 * 工程款3_nud.Value : 金額4_und.Value = NUD3.Value / 100 * 工程款4_nud.Value 金額5_und.Value = NUD3.Value / 100 * 工程款5_nud.Value 金額6_und.Value = 金額1_und.Value + 金額2_und.Value + 金額3_und.Value + 金額4_und.Value + 金額5_und.Value End If End Sub Private Sub CH1_CheckedChanged(sender As Object, e As EventArgs) Handles CH1.Click CH1.Checked = True : CH2.Checked = False : NUD1.Enabled = True : NUD3.Enabled = False End Sub Private Sub CH2_CheckedChanged(sender As Object, e As EventArgs) Handles CH2.Click CH1.Checked = False : CH2.Checked = True : NUD1.Enabled = False : NUD3.Enabled = True End Sub Private Sub 工程款1_nud_ValueChanged(sender As Object, e As EventArgs) Handles 工程款1_nud.ValueChanged 工程款6_nud.Value = 工程款1_nud.Value + 工程款2_nud.Value + 工程款3_nud.Value + 工程款4_nud.Value + 工程款5_nud.Value 金額1_und.Value = NUD3.Value / 100 * 工程款1_nud.Value : 金額6_und.Value = 金額1_und.Value + 金額2_und.Value + 金額3_und.Value + 金額4_und.Value + 金額5_und.Value End Sub Private Sub 工程款2_nud_ValueChanged(sender As Object, e As EventArgs) Handles 工程款2_nud.ValueChanged 工程款6_nud.Value = 工程款1_nud.Value + 工程款2_nud.Value + 工程款3_nud.Value + 工程款4_nud.Value + 工程款5_nud.Value 金額2_und.Value = NUD3.Value / 100 * 工程款2_nud.Value : 金額6_und.Value = 金額1_und.Value + 金額2_und.Value + 金額3_und.Value + 金額4_und.Value + 金額5_und.Value End Sub Private Sub 工程款3_nud_ValueChanged(sender As Object, e As EventArgs) Handles 工程款3_nud.ValueChanged 工程款6_nud.Value = 工程款1_nud.Value + 工程款2_nud.Value + 工程款3_nud.Value + 工程款4_nud.Value + 工程款5_nud.Value 金額3_und.Value = NUD3.Value / 100 * 工程款3_nud.Value : 金額6_und.Value = 金額1_und.Value + 金額2_und.Value + 金額3_und.Value + 金額4_und.Value + 金額5_und.Value End Sub Private Sub 工程款4_nud_ValueChanged(sender As Object, e As EventArgs) Handles 工程款4_nud.ValueChanged 工程款6_nud.Value = 工程款1_nud.Value + 工程款2_nud.Value + 工程款3_nud.Value + 工程款4_nud.Value + 工程款5_nud.Value 金額4_und.Value = NUD3.Value / 100 * 工程款4_nud.Value : 金額6_und.Value = 金額1_und.Value + 金額2_und.Value + 金額3_und.Value + 金額4_und.Value + 金額5_und.Value End Sub Private Sub 工程款5_nud_ValueChanged(sender As Object, e As EventArgs) Handles 工程款5_nud.ValueChanged 工程款6_nud.Value = 工程款1_nud.Value + 工程款2_nud.Value + 工程款3_nud.Value + 工程款4_nud.Value + 工程款5_nud.Value 金額5_und.Value = NUD3.Value / 100 * 工程款5_nud.Value : 金額6_und.Value = 金額1_und.Value + 金額2_und.Value + 金額3_und.Value + 金額4_und.Value + 金額5_und.Value End Sub Private Sub NUD4_ValueChanged(sender As Object, e As EventArgs) Handles NUD4.ValueChanged NUD6.Value = NUD4.Value + NUD5.Value End Sub Private Sub NUD5_ValueChanged(sender As Object, e As EventArgs) Handles NUD5.ValueChanged NUD6.Value = NUD4.Value + NUD5.Value End Sub Private Sub 比例_nud_ValueChanged(sender As Object, e As EventArgs) Handles 比例_nud.ValueChanged 請款金額_nud.Value = NUD1.Value / 100 * 比例_nud.Value End Sub Private Sub 稅金_nud_ValueChanged(sender As Object, e As EventArgs) Handles 稅金_nud.ValueChanged 請款總額_nud.Value = 請款金額_nud.Value / 100 * 稅金_nud.Value + 請款金額_nud.Value End Sub Private Sub 請款金額_nud_ValueChanged(sender As Object, e As EventArgs) Handles 請款金額_nud.ValueChanged If 請款金額_nud.Value / NUD1.Value * 100 > 100 Then : 比例_nud.Value = 100 : Else : 比例_nud.Value = 請款金額_nud.Value / NUD1.Value * 100 : End If 請款總額_nud.Value = 請款金額_nud.Value / 100 * 稅金_nud.Value + 請款金額_nud.Value End Sub Private Sub 請款總額_nud_ValueChanged(sender As Object, e As EventArgs) Handles 請款總額_nud.ValueChanged 請款金額_nud.Value = 請款總額_nud.Value / (100 + 稅金_nud.Value) * 100 End Sub Private Sub 請款期數_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 請款期數_cb.SelectedIndexChanged If 請款期數_cb.Text = "" Then : 比例_nud.Value = 0 ElseIf 請款期數_cb.Text = "一" Then 比例_nud.Value = 工程款1_nud.Value : 請款內容_tb.Text = "Prepayments 預付款" : 主頁明細_ch.Checked = False : 報告移交單_ch.Checked = False ElseIf 請款期數_cb.Text = "二" Then 比例_nud.Value = 工程款2_nud.Value : 請款內容_tb.Text = "Material Cost Application 材料到貨款" : 主頁明細_ch.Checked = False : 報告移交單_ch.Checked = False ElseIf 請款期數_cb.Text = "三" Then 比例_nud.Value = 工程款3_nud.Value : 請款內容_tb.Text = "Installation Fee Application 施工請款 " : 主頁明細_ch.Checked = False : 報告移交單_ch.Checked = False ElseIf 請款期數_cb.Text = "四" Then 比例_nud.Value = 工程款4_nud.Value : 請款內容_tb.Text = "Final Acceptance 驗收款 " : 主頁明細_ch.Checked = True : 報告移交單_ch.Checked = True ElseIf 請款期數_cb.Text = "五" Then 比例_nud.Value = 工程款5_nud.Value : 請款內容_tb.Text = "Assure 保留款 " : 主頁明細_ch.Checked = False : 報告移交單_ch.Checked = True End If End Sub Private Sub 新增資料_bt_Click(sender As Object, e As EventArgs) Handles 新增資料_bt.Click If 合約編號_tb.Text = "" Then If 系統語言 = "繁體中文" Then : MsgBox("資訊不夠,無法生成明細!!") : Else : MsgBox("Tidak cukup informasi untuk menghasilkan detail!!") : End If : Else If 工程款6_nud.Value <> 100 Then If 系統語言 = "繁體中文" Then : MsgBox("工程款估驗 不等於 100%!!") : Else : MsgBox("Penilaian biaya proyek tidak sama dengan 100%!!") : End If : Else PA = 合約編號_tb.Text : 合約明細存檔() Dim SS As String If 系統語言 = "繁體中文" Then : SS = "合約工期款項細分不可大於10筆!!" : Else : SS = "Pembagian pembayaran durasi kontrak tidak boleh lebih dari 10 !!" : End If If TabControl2.SelectedIndex = 0 Then If 第1期_dgv.Rows.Count = 10 Then : MsgBox(SS) : Else : PA1 = "1" : PA2 = 第1期_dgv.Rows.Count + 1 : SQL_合約明細新增() : End If ElseIf TabControl2.SelectedIndex = 1 Then If 第2期_dgv.Rows.Count = 10 Then : MsgBox(SS) : Else : PA1 = "2" : PA2 = 第2期_dgv.Rows.Count + 1 : SQL_合約明細新增() : End If ElseIf TabControl2.SelectedIndex = 2 Then If 第3期_dgv.Rows.Count = 10 Then : MsgBox(SS) : Else : PA1 = "3" : PA2 = 第3期_dgv.Rows.Count + 1 : SQL_合約明細新增() : End If ElseIf TabControl2.SelectedIndex = 3 Then If 第4期_dgv.Rows.Count = 10 Then : MsgBox(SS) : Else : PA1 = "4" : PA2 = 第4期_dgv.Rows.Count + 1 : SQL_合約明細新增() : End If ElseIf TabControl2.SelectedIndex = 4 Then If 第5期_dgv.Rows.Count = 10 Then : MsgBox(SS) : Else : PA1 = "5" : PA2 = 第5期_dgv.Rows.Count + 1 : SQL_合約明細新增() : End If End If PA = 合約編號_tb.Text PA1 = "1" : Set_合約明細1() : PA1 = "2" : Set_合約明細2() : PA1 = "3" : Set_合約明細3() : PA1 = "4" : Set_合約明細4() : PA1 = "5" : Set_合約明細5() : MsgBox("新增完成!!") End If End If End Sub Private Sub 刪除資料_bt_Click(sender As Object, e As EventArgs) Handles 刪除資料_bt.Click If 合約編號_tb.Text = "" Or 明細選項_bt.Text = "" Then If 系統語言 = "繁體中文" Then : MsgBox("資訊不夠,無法生成明細!!") : Else : MsgBox("Tidak cukup informasi untuk menghasilkan detail!!") : End If : Else If 工程款6_nud.Value <> 100 Then If 系統語言 = "繁體中文" Then : MsgBox("工程款估驗 不等於 100%!!") : Else : MsgBox("Penilaian biaya proyek tidak sama dengan 100%!!") : End If : Else PA = 合約編號_tb.Text If TabControl2.SelectedIndex = 0 Then : PA1 = "1" : PA2 = 明細選項_bt.Text : SQL_合約明細刪除() ElseIf TabControl2.SelectedIndex = 1 Then : PA1 = "2" : PA2 = 明細選項_bt.Text : SQL_合約明細刪除() ElseIf TabControl2.SelectedIndex = 2 Then : PA1 = "3" : PA2 = 明細選項_bt.Text : SQL_合約明細刪除() ElseIf TabControl2.SelectedIndex = 3 Then : PA1 = "4" : PA2 = 明細選項_bt.Text : SQL_合約明細刪除() ElseIf TabControl2.SelectedIndex = 4 Then : PA1 = "5" : PA2 = 明細選項_bt.Text : SQL_合約明細刪除() End If PA = 合約編號_tb.Text PA1 = "1" : Set_合約明細1() : PA1 = "2" : Set_合約明細2() : PA1 = "3" : Set_合約明細3() : PA1 = "4" : Set_合約明細4() : PA1 = "5" : Set_合約明細5() : MsgBox("刪除完成!!") End If End If End Sub Private Sub 存檔_tb_Click(sender As Object, e As EventArgs) Handles 存檔_tb.Click 合約明細存檔() : If 系統語言 = "繁體中文" Then : MsgBox("存檔完成!!") : Else : MsgBox("Arsip selesai!!") : End If End Sub Private Sub 合約明細存檔() For i As Integer = 0 To 第1期_dgv.Rows.Count - 1 PA1 = "1" : PA2 = 第1期_dgv.Rows(i).Cells("細項").Value : PA3 = 第1期_dgv.Rows(i).Cells("內容").Value NU1 = 第1期_dgv.Rows(i).Cells("比例").Value : NU2 = 第1期_dgv.Rows(i).Cells("金額").Value : SQL_合約明細修改() Next For i As Integer = 0 To 第2期_dgv.Rows.Count - 1 PA1 = "2" : PA2 = 第2期_dgv.Rows(i).Cells("細項").Value : PA3 = 第2期_dgv.Rows(i).Cells("內容").Value NU1 = 第2期_dgv.Rows(i).Cells("比例").Value : NU2 = 第2期_dgv.Rows(i).Cells("金額").Value : SQL_合約明細修改() Next For i As Integer = 0 To 第3期_dgv.Rows.Count - 1 PA1 = "3" : PA2 = 第3期_dgv.Rows(i).Cells("細項").Value : PA3 = 第3期_dgv.Rows(i).Cells("內容").Value NU1 = 第3期_dgv.Rows(i).Cells("比例").Value : NU2 = 第3期_dgv.Rows(i).Cells("金額").Value : SQL_合約明細修改() Next For i As Integer = 0 To 第4期_dgv.Rows.Count - 1 PA1 = "4" : PA2 = 第4期_dgv.Rows(i).Cells("細項").Value : PA3 = 第4期_dgv.Rows(i).Cells("內容").Value NU1 = 第4期_dgv.Rows(i).Cells("比例").Value : NU2 = 第4期_dgv.Rows(i).Cells("金額").Value : SQL_合約明細修改() Next For i As Integer = 0 To 第5期_dgv.Rows.Count - 1 PA1 = "5" : PA2 = 第5期_dgv.Rows(i).Cells("細項").Value : PA3 = 第5期_dgv.Rows(i).Cells("內容").Value NU1 = 第5期_dgv.Rows(i).Cells("比例").Value : NU2 = 第5期_dgv.Rows(i).Cells("金額").Value : SQL_合約明細修改() Next End Sub Private Sub 查詢_bt_Click(sender As Object, e As EventArgs) Handles 查詢_bt.Click PA = 關鍵字搜尋_tb.Text : Set_合約清單() End Sub Private Sub 開新的請款單_bt_Click(sender As Object, e As EventArgs) Handles 開新的請款單_bt.Click If 合約編號_tb.Text = "" Then : If 系統語言 = "繁體中文" Then : MsgBox("請先選擇合約!!") : Else : MsgBox("Silakan pilih kontrak terlebih dahulu!!") : End If : Else SQL_請款單_最後一筆資料() If dr.Read() Then : EDR = Double.Parse(Strings.Right(dr("請款編號").ToString, 9)) : Else : EDR = 0 : End If conn.Close() : EDR += 1 If EDR < 10 Then : ESTR = "HP" & "00000000" & EDR ElseIf EDR > 9 And EDR < 100 Then : ESTR = "HP" & "0000000" & EDR ElseIf EDR > 99 And EDR < 1000 Then : ESTR = "HP" & "000000" & EDR ElseIf EDR > 999 And EDR < 10000 Then : ESTR = "HP" & "00000" & EDR ElseIf EDR > 9999 And EDR < 100000 Then : ESTR = "HP" & "0000" & EDR ElseIf EDR > 99999 And EDR < 100000 Then : ESTR = "HP" & "000" & EDR ElseIf EDR > 999999 And EDR < 1000000 Then : ESTR = "HP" & "00" & EDR ElseIf EDR > 9999999 And EDR < 10000000 Then : ESTR = "HP" & "0" & EDR ElseIf EDR > 99999999 Then : ESTR = "HP" & EDR : End If 請款單號_tb.Text = ESTR : 請款期數_cb.Text = "" : 比例_nud.Value = 0 : 稅金_nud.Value = 11 付款期限_cb.Text = "" : 申請日期_dtp.Value = Today() End If End Sub Private Sub 存檔_bt_Click(sender As Object, e As EventArgs) Handles 存檔_bt.Click If 合約編號_tb.Text = "" Then : If 系統語言 = "繁體中文" Then : MsgBox("請先選擇合約!!") : Else : MsgBox("Silakan pilih kontrak terlebih dahulu!!") : End If : Else If 請款單號_tb.Text = "" Then If 系統語言 = "繁體中文" Then : MsgBox("請先案開新請款單或是選擇舊請款單!!") : Else : MsgBox("Silahkan pilih buka invoice baru atau pilih invoice lama dulu!!") : End If : Else If 請款期數_cb.Text = "" Then : If 系統語言 = "繁體中文" Then : MsgBox("請先選擇請款期數!!") : Else : MsgBox("Silahkan pilih yang mana!!") : End If : Else If 請款金額_nud.Value = 0 Then : If 系統語言 = "繁體中文" Then : MsgBox("請款金額不可為零!!") : Else : MsgBox("Jumlah yang diminta tidak boleh nol!!") : End If : Else If 付款期限_cb.Text = "" Then : If 系統語言 = "繁體中文" Then : MsgBox("沒有指定付款期限!!") : Else : MsgBox("Tidak ada batas waktu pembayaran yang ditentukan!!") : End If : Else PA = 合約編號_tb.Text : PA1 = 請款單號_tb.Text : PA2 = 請款期數_cb.Text : PA3 = 請款內容_tb.Text : PA4 = 請款金額_nud.Value : PA5 = 稅金_nud.Value PA6 = 付款期限_cb.Text : PA7 = Strings.Format(申請日期_dtp.Value, "yyyy/MM/dd") : PA8 = 其他意見_tb.Text : PA9 = 請款總額_nud.Value : PA10 = 比例_nud.Value SQL_請款單_最後一筆資料1() If dr.Read() Then : SQL_請款單_修改() Else If 請款金額_nud.Value > ANUD5.Value Then If 系統語言 = "繁體中文" Then : MsgBox("請款單大於剩餘款,無法新增請款單!!") Else : MsgBox("Permintaan lebih besar dari jumlah yang tersisa dan tidak dapat ditambahkan!!") : End If : Else SQL_請款單_新增() End If End If : Set_請款清單() : 請款計算() : If 系統語言 = "繁體中文" Then : MsgBox("存檔完成!!") : Else : MsgBox("Arsip selesai!!") : End If End If End If End If End If End If End Sub Private Sub 刪除_bt_Click(sender As Object, e As EventArgs) Handles 刪除_bt.Click If 合約編號_tb.Text = "" Then : If 系統語言 = "繁體中文" Then : MsgBox("請先選擇合約!!") : Else : MsgBox("Silakan pilih kontrak terlebih dahulu!!") : End If : Else If 請款單號_tb.Text = "" Then : If 系統語言 = "繁體中文" Then : MsgBox("請先選擇請款單!!") : Else : MsgBox("Silakan pilih faktur terlebih dahulu!!") : End If : Else PA1 = 請款單號_tb.Text : SQL_請款單_刪除() : Set_請款清單() : 請款計算() If 系統語言 = "繁體中文" Then : MsgBox("合約請款單刪除完成!!") : Else : MsgBox("hapus selesai!!") : End If End If End If End Sub Private Sub 報告移交() B02_tb.Text = Strings.Right(Strings.Format(Today(), "yyyy/MM/dd"), 2) : B04_tb.Text = Strings.Left(Strings.Format(Today(), "yyyy/MM/dd"), 4) If Strings.Mid(Strings.Format(Today(), "yyyy/MM/dd"), 6, 2) = "01" Then : B03_tb.Text = "Jan" ElseIf Strings.Mid(Strings.Format(Today(), "yyyy/MM/dd"), 6, 2) = "02" Then : B03_tb.Text = "Feb" ElseIf Strings.Mid(Strings.Format(Today(), "yyyy/MM/dd"), 6, 2) = "03" Then : B03_tb.Text = "Ber" ElseIf Strings.Mid(Strings.Format(Today(), "yyyy/MM/dd"), 6, 2) = "04" Then : B03_tb.Text = "Apr" ElseIf Strings.Mid(Strings.Format(Today(), "yyyy/MM/dd"), 6, 2) = "05" Then : B03_tb.Text = "Mun" ElseIf Strings.Mid(Strings.Format(Today(), "yyyy/MM/dd"), 6, 2) = "06" Then : B03_tb.Text = "Jun" ElseIf Strings.Mid(Strings.Format(Today(), "yyyy/MM/dd"), 6, 2) = "07" Then : B03_tb.Text = "Jul" ElseIf Strings.Mid(Strings.Format(Today(), "yyyy/MM/dd"), 6, 2) = "08" Then : B03_tb.Text = "Agu" ElseIf Strings.Mid(Strings.Format(Today(), "yyyy/MM/dd"), 6, 2) = "09" Then : B03_tb.Text = "Sep" ElseIf Strings.Mid(Strings.Format(Today(), "yyyy/MM/dd"), 6, 2) = "10" Then : B03_tb.Text = "Okt" ElseIf Strings.Mid(Strings.Format(Today(), "yyyy/MM/dd"), 6, 2) = "11" Then : B03_tb.Text = "Nov" ElseIf Strings.Mid(Strings.Format(Today(), "yyyy/MM/dd"), 6, 2) = "12" Then : B03_tb.Text = "Des" : End If B36_tb.Text = B02_tb.Text : B37_tb.Text = B03_tb.Text : B38_tb.Text = B04_tb.Text B07_tb.Text = 客戶名稱_tb.Text : B30_tb.Text = 客戶名稱_tb.Text : B42_tb.Text = 客戶名稱_tb.Text : B22_tb.Text = 合約編號_tb.Text : B23_tb.Text = 工程名稱_英_tb.Text If Strings.Left(合約編號_tb.Text, 2) = "HX" Then : B12_tb.Text = "PT HONG XHE INDUSTRIAL" : B43_tb.Text = "PT HONG XHE INDUSTRIAL" Else : B12_tb.Text = "PT PUNCAK GEMILANG SEMESTA" : B43_tb.Text = "PT PUNCAK GEMILANG SEMESTA" : End If End Sub Private Sub 報告移交計算() If 請款期數_cb.Text = "四" Then Dim SS As Integer = 0 For i As Integer = 0 To 請款單_dgv.Rows.Count - 1 : If 請款單_dgv("期數", i).Value.ToString() <> "五" Then : SS += 請款單_dgv("比例", i).Value : End If : Next B32_tb.Text = "Pihak kesatu (I) telah memeriksa hasil pekerjaan Pihak kedua (II) yang telah selesai dikerjakan sesuai dengan kontrak." A01_lb.Text = "BERITA ACARA SERAH TERIMA PERTAMA" : B31_tb.Text = "Penagihan Invoice Pelunasan " & SS & "%" : 報告移交() B19_tb.Visible = True : B27_tb.Visible = True : B28_tb.Visible = True : B29_tb.Visible = True : B33_tb.Visible = True B44_tb.Visible = True : B45_tb.Visible = True : B46_tb.Visible = True : 報告移交單_ch.Enabled = True ElseIf 請款期數_cb.Text = "五" Then B32_tb.Text = "Pihak kesatu (I) telah memeriksa hasil pekerjaan Pihak kedua (II) yang telah selesai dikerjakan dan dinyatakan 100% selesai dalam masa garansi." A01_lb.Text = "BERITA ACARA SERAH TERIMA KEDUA" : B31_tb.Text = "Penagihan Invoice Pelunasan 100%" : 報告移交() B19_tb.Visible = False : B27_tb.Visible = False : B28_tb.Visible = False : B29_tb.Visible = False : B33_tb.Visible = False B44_tb.Visible = False : B45_tb.Visible = False : B46_tb.Visible = False : 報告移交單_ch.Enabled = True Else 視窗2_pl.Visible = False : 報告移交單_ch.Enabled = False : 報告移交單_ch.Checked = False End If End Sub Private Sub 報告移交_bt_Click(sender As Object, e As EventArgs) Handles 報告移交_bt.Click If 視窗2_pl.Visible = False Then : 視窗2_pl.BringToFront() If 請款期數_cb.Text = "四" Then : 視窗2_pl.Location = New System.Drawing.Point(261, 19) : 視窗2_pl.Visible = True : 報告移交計算() ElseIf 請款期數_cb.Text = "五" Then : 視窗2_pl.Location = New System.Drawing.Point(261, 19) : 視窗2_pl.Visible = True : 報告移交計算() Else : 視窗2_pl.Visible = False : 報告移交單_ch.Checked = False If 系統語言 = "繁體中文" Then : MsgBox("所選請款期數,無法列印報告移交單!!") Else : MsgBox("Periode pengambilan yang dipilih tidak dapat mencetak slip serah terima laporan!!") : End If : End If Else : 視窗2_pl.Visible = False : End If End Sub Private Sub CanceL2_bt_Click(sender As Object, e As EventArgs) Handles CanceL2_bt.Click If 視窗2_pl.Visible = False Then : 視窗2_pl.Visible = True : 視窗2_pl.BringToFront() : Else 視窗2_pl.Visible = False : End If End Sub Private Sub 視窗2_pl_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 視窗2_pl.MouseDown If e.Button = MouseButtons.Left Then : OldX = e.X : OldY = e.Y : drag = True : End If End Sub Private Sub 視窗2_pl_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 視窗2_pl.MouseMove If drag Then : 視窗2_pl.Left = 視窗2_pl.Left + e.X - OldX : 視窗2_pl.Top = 視窗2_pl.Top + e.Y - OldY : End If End Sub Private Sub 縮放2_bt_Click(sender As Object, e As EventArgs) Handles 縮放2_bt.Click Dim NX, NY As Integer : NX = 合約_dgv.Size.Width : NY = 合約_dgv.Size.Height If 放大 = True Then 合約_dgv.Size = New System.Drawing.Point(NX - 400, NY) : 放大 = False : 合約_dgv.Columns("工程名稱_中").Visible = False Else 合約_dgv.Size = New System.Drawing.Point(NX + 400, NY) : 放大 = True : 合約_dgv.Columns("工程名稱_中").Visible = True End If End Sub Private Sub 視窗2_pl_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 視窗2_pl.MouseUp drag = False End Sub Private Sub 列印_bt_Click(sender As Object, e As EventArgs) Handles 列印_bt.Click If 合約編號_tb.Text = "" Then If 系統語言 = "繁體中文" Then : MsgBox("請先選擇合約!!") : Else : MsgBox("Silakan pilih kontrak terlebih dahulu!!") : End If : Else If 請款單號_tb.Text = "" Then If 系統語言 = "繁體中文" Then : MsgBox("請先選擇請款單!!") : Else : MsgBox("Silakan pilih faktur terlebih dahulu!!") : End If : Else If 請款期數_cb.Text = "" Then If 系統語言 = "繁體中文" Then : MsgBox("沒有請款期數,無法列印!!") : Else : MsgBox("Tidak ada waktu pembayaran, tidak dapat mencetak!!") : End If : Else If 請款金額_nud.Value = 0 Then If 系統語言 = "繁體中文" Then : MsgBox("請款金額為零,無法列印!!") : Else : MsgBox("Jumlah yang diminta adalah nol dan tidak dapat dicetak!!") : End If : Else If 付款期限_cb.Text = "" Then If 系統語言 = "繁體中文" Then : MsgBox("沒有指定付款期限,無法列印!!") : Else : MsgBox("Tidak ada waktu pembayaran, tidak dapat mencetak!!") : End If : Else Try xlApp = CType(CreateObject("Excel.Application"), Application) xlApp.Visible = True xlApp.DisplayAlerts = True xlApp.Application.WindowState = xlMaximized xlBook = xlApp.Workbooks.Add '---------------------------------------------------------------------------------------------------------------------- If 報告移交單_ch.Checked = True Then xlSheet = NewMethod(xlBook) : xlApp.Sheets(1).Select : xlApp.Sheets(1).Name = "報告移交單" xlBook.Activate() : xlSheet.Activate() xlSheet.Cells(2, 1) = A01_lb.Text : xlSheet.Cells(4, 1) = B01_tb.Text & " " & B02_tb.Text & " " & B03_tb.Text & " " & B04_tb.Text & " " & B05_tb.Text xlSheet.Cells(6, 1) = B06_tb.Text : xlSheet.Cells(6, 3) = B07_tb.Text : xlSheet.Cells(7, 1) = B08_tb.Text : xlSheet.Cells(7, 3) = B09_tb.Text xlSheet.Cells(9, 1) = B10_tb.Text : xlSheet.Cells(11, 1) = B11_tb.Text : xlSheet.Cells(11, 3) = B12_tb.Text : xlSheet.Cells(12, 1) = B13_tb.Text xlSheet.Cells(12, 3) = B14_tb.Text : xlSheet.Cells(14, 1) = B15_tb.Text xlSheet.Cells(16, 2) = B16_tb.Text : xlSheet.Cells(16, 3) = "':" : xlSheet.Cells(16, 4) = B22_tb.Text xlSheet.Cells(17, 2) = B17_tb.Text : xlSheet.Cells(17, 3) = "':" : xlSheet.Cells(17, 4) = B23_tb.Text xlSheet.Cells(18, 2) = B18_tb.Text : xlSheet.Cells(18, 3) = "':" : xlSheet.Cells(18, 4) = B24_tb.Text & " " & B25_tb.Text & " " & B26_tb.Text Dim NX As Integer = 19 If 請款期數_cb.Text = "四" Then xlSheet.Cells(NX, 2) = B19_tb.Text : xlSheet.Cells(NX, 3) = "':" : xlSheet.Cells(NX, 4) = B27_tb.Text & " " & B28_tb.Text & " " & B29_tb.Text : NX += 1 xlSheet.Cells(NX, 2) = B20_tb.Text : xlSheet.Cells(NX, 3) = "':" : xlSheet.Cells(NX, 4) = B30_tb.Text : NX += 1 xlSheet.Cells(NX, 2) = B21_tb.Text : xlSheet.Cells(NX, 3) = "':" : xlSheet.Cells(NX, 4) = B31_tb.Text : NX += 2 xlSheet.Cells(NX, 1) = B32_tb.Text : NX += 1 xlSheet.Cells(NX, 1) = B33_tb.Text + " " + B44_tb.Text + " " + B45_tb.Text + " " & B46_tb.Text : NX += 1 xlSheet.Cells(NX, 1) = B34_tb.Text : NX += 2 xlSheet.Cells(NX, 4) = B35_tb.Text : xlSheet.Cells(NX, 5) = B36_tb.Text & " " & B37_tb.Text & " " & B38_tb.Text : NX += 2 xlSheet.Cells(NX, 5) = B39_tb.Text : NX += 1 xlSheet.Cells(NX, 2) = B40_tb.Text : xlSheet.Cells(NX, 5) = B41_tb.Text : NX += 1 xlSheet.Cells(NX, 2) = B42_tb.Text : xlSheet.Cells(NX, 5) = B43_tb.Text Else xlSheet.Cells(NX, 2) = B20_tb.Text : xlSheet.Cells(NX, 3) = "':" : xlSheet.Cells(NX, 4) = B30_tb.Text : NX += 1 xlSheet.Cells(NX, 2) = B21_tb.Text : xlSheet.Cells(NX, 3) = "':" : xlSheet.Cells(NX, 4) = B31_tb.Text : NX += 2 xlSheet.Cells(NX, 1) = B32_tb.Text : NX += 1 : xlSheet.Cells(NX, 1) = B34_tb.Text : NX += 2 xlSheet.Cells(NX, 4) = B35_tb.Text : xlSheet.Cells(NX, 5) = B36_tb.Text & " " & B37_tb.Text & " " & B38_tb.Text : NX += 2 xlSheet.Cells(NX, 5) = B39_tb.Text : NX += 1 xlSheet.Cells(NX, 2) = B40_tb.Text : xlSheet.Cells(NX, 5) = B41_tb.Text : NX += 1 xlSheet.Cells(NX, 2) = B42_tb.Text : xlSheet.Cells(NX, 5) = B43_tb.Text End If AB(xlApp, xlSheet) If Strings.Left(合約編號_tb.Text, 2) = "HX" Then : CC(xlApp, xlSheet) : Else : DD(xlApp, xlSheet) : End If : FF(xlApp, xlSheet) End If '---------------------------------------------------------------------------------------------------------------------- If 請款單_ch.Checked = True Then xlSheet = NewMethod(xlBook) : xlApp.Sheets(1).Select : xlApp.Sheets(1).Name = "請款單" xlBook.Activate() : xlSheet.Activate() xlSheet.Cells(2, 1) = "請款明細表 Rincian Tagihan" : xlSheet.Cells(3, 1) = "TO : " & 客戶名稱_tb.Text xlSheet.Cells(3, 9) = "日期 : " & Strings.Format(Today(), "yyyy/MM/dd") xlSheet.Cells(4, 1) = "工程項目 : " & 工程名稱_中_tb.Text & vbCrLf & 工程名稱_英_tb.Text : xlSheet.Cells(4, 9) = "期別 : 第" & 請款期數_cb.Text & "期" xlSheet.Cells(5, 1) = "(未稅)本合約工程款 Total Kontrak Sebelum Ppn Rp : " If 稅額顯示_lb.Text = "PPN 10%稅額 = Rp. " Then : xlSheet.Cells(5, 5) = 金額6_und.Value / 110 * 100 : Else : xlSheet.Cells(5, 5) = 金額6_und.Value / 111 * 100 : End If xlSheet.Cells(7, 1) = "No." : xlSheet.Cells(7, 2) = "Description" : xlSheet.Cells(7, 3) = "Rate" : xlSheet.Cells(7, 4) = "Total Amount" & vbCrLf & "總金額" xlSheet.Cells(7, 5) = "This Period" & vbCrLf & "本期請款" : xlSheet.Cells(7, 7) = "Accumulation" & vbCrLf & "累計請款" : xlSheet.Cells(7, 9) = "Remarks" If 新版_ch.Checked = False Then xlSheet.Cells(8, 1) = "1" : xlSheet.Cells(8, 2) = "Prepayments" & vbCrLf & "(預付款)" : xlSheet.Cells(8, 3) = 工程款1_nud.Value / 100 If 請款期數_cb.Text = "一" Then : xlSheet.Cells(8, 5) = "=C8" : Else : xlSheet.Cells(8, 5) = "0" : End If xlSheet.Cells(9, 1) = "2" : xlSheet.Cells(9, 2) = "Material Cost Application" & vbCrLf & "(材料到貨款)" : xlSheet.Cells(9, 3) = 工程款2_nud.Value / 100 If 請款期數_cb.Text = "二" Then : xlSheet.Cells(9, 5) = "=C9" : Else : xlSheet.Cells(9, 5) = "0" : End If xlSheet.Cells(10, 1) = "3" : xlSheet.Cells(10, 2) = "Installation Fee Application" & vbCrLf & "(施工請款)" : xlSheet.Cells(10, 3) = 工程款3_nud.Value / 100 If 請款期數_cb.Text = "三" Then : xlSheet.Cells(10, 5) = "=C10" : Else : xlSheet.Cells(10, 5) = "0" : End If xlSheet.Cells(11, 1) = "4" : xlSheet.Cells(11, 2) = "Final Acceptance" & vbCrLf & "(驗收款)" : xlSheet.Cells(11, 3) = 工程款4_nud.Value / 100 If 請款期數_cb.Text = "四" Then : xlSheet.Cells(11, 5) = "=C11" : Else : xlSheet.Cells(11, 5) = "0" : End If xlSheet.Cells(12, 1) = "5" : xlSheet.Cells(12, 2) = "Assure" & vbCrLf & "(保留款)" : xlSheet.Cells(12, 3) = 工程款5_nud.Value / 100 If 請款期數_cb.Text = "五" Then : xlSheet.Cells(12, 5) = "=C12" : Else : xlSheet.Cells(12, 5) = "0" : End If For i As Integer = 8 To 12 If i = 11 Then : xlSheet.Cells(i, 4) = "=C" & i & "*$E$5 + " & ANUD3.Value : Else : xlSheet.Cells(i, 4) = "=C" & i & "*$E$5" : End If xlSheet.Cells(i, 6) = "=IF(E" & i & "=0,0,D" & i & ")" : If i = 8 Then : xlSheet.Cells(i, 7) = "=IF(E" & i & "=0,C" & i & ",0)" Else : xlSheet.Cells(i, 7) = "=IF(G" & i - 1 & "=0,0,IF(E" & i & "=0,C" & i & ",0))" : End If xlSheet.Cells(i, 8) = "=G" & i & "*$E$5" Next xlSheet.Cells(13, 1) = "Total" : xlSheet.Cells(13, 4) = "=D12+D11+D10+D9+D8" : xlSheet.Cells(13, 5) = "=E8+E9+E10+E11+E12" xlSheet.Cells(13, 6) = "=F8+F9+F10+F11+F12" : xlSheet.Cells(13, 7) = "=G8+G9+G10+G11+G12" : xlSheet.Cells(13, 8) = "=H8+H9+H10+H11+H12" xlSheet.Cells(15, 2) = "本期估驗 Nominal Tagihan" & vbCrLf & "(未稅Belum Termasuk Pajak)" : xlSheet.Cells(15, 3) = "' : " xlSheet.Cells(15, 4) = "=F13" : xlSheet.Cells(16, 2) = "PPN " & 稅金_nud.Value & "%" : xlSheet.Cells(16, 3) = "' : " xlSheet.Cells(16, 4) = 請款總額_nud.Value - 請款金額_nud.Value : xlSheet.Cells(17, 4) = "=D15+D16" xlSheet.Cells(18, 1) = "本期請款金額 Total Tagihan : Rp" : xlSheet.Cells(18, 3) = "' : " : xlSheet.Cells(18, 4) = "=D17" xlSheet.Cells(18, 7) = "元整" : xlSheet.Cells(18, 8) = "(含稅) Termasuk Ppn" : xlSheet.Cells(21, 2) = 客戶名稱_tb.Text : xlSheet.Cells(22, 2) = "驗收代表人" BB(xlApp, xlSheet) Else xlSheet.Cells(8, 1) = "1" : xlSheet.Cells(8, 2) = "Prepayments" & vbCrLf & "(預付款)" : xlSheet.Cells(8, 3) = 工程款1_nud.Value / 100 If 請款期數_cb.Text = "一" Then : xlSheet.Cells(8, 5) = "=C8" : Else : xlSheet.Cells(8, 5) = "0" : End If xlSheet.Cells(9, 1) = "2" : xlSheet.Cells(9, 2) = "Material Cost Application" & vbCrLf & "(材料到貨款)" : xlSheet.Cells(9, 3) = 工程款2_nud.Value / 100 If 請款期數_cb.Text = "二" Then : xlSheet.Cells(9, 5) = "=C9" : Else : xlSheet.Cells(9, 5) = "0" : End If xlSheet.Cells(10, 1) = "3" : xlSheet.Cells(10, 2) = "Installation Fee & Final Application" & vbCrLf & "(施工.驗收款)" xlSheet.Cells(10, 3) = 工程款4_nud.Value / 100 + 工程款3_nud.Value / 100 If 請款期數_cb.Text = "三" Or 請款期數_cb.Text = "四" Then : xlSheet.Cells(10, 5) = "=C10" : Else : xlSheet.Cells(10, 5) = "0" : End If xlSheet.Cells(11, 1) = "4" : xlSheet.Cells(11, 2) = "Assure" & vbCrLf & "(保留款)" : xlSheet.Cells(11, 3) = 工程款5_nud.Value / 100 If 請款期數_cb.Text = "五" Then : xlSheet.Cells(11, 5) = "=C11" : Else : xlSheet.Cells(11, 5) = "0" : End If For i As Integer = 8 To 11 If i = 10 Then : xlSheet.Cells(i, 4) = "=C" & i & "*$E$5 + " & ANUD3.Value : Else : xlSheet.Cells(i, 4) = "=C" & i & "*$E$5" : End If xlSheet.Cells(i, 6) = "=IF(E" & i & "=0,0,D" & i & ")" : If i = 8 Then : xlSheet.Cells(i, 7) = "=IF(E" & i & "=0,C" & i & ",0)" Else : xlSheet.Cells(i, 7) = "=IF(G" & i - 1 & "=0,0,IF(E" & i & "=0,C" & i & ",0))" : End If xlSheet.Cells(i, 8) = "=G" & i & "*$E$5" Next xlSheet.Cells(12, 1) = "Total" : xlSheet.Cells(12, 4) = "=D11+D10+D9+D8" : xlSheet.Cells(12, 5) = "=E8+E9+E10+E11" xlSheet.Cells(12, 6) = "=F8+F9+F10+F11" : xlSheet.Cells(12, 7) = "=G8+G9+G10+G11" : xlSheet.Cells(12, 8) = "=H8+H9+H10+H11" xlSheet.Cells(14, 2) = "本期估驗 Nominal Tagihan" & vbCrLf & "(未稅Belum Termasuk Pajak)" : xlSheet.Cells(14, 3) = "' : " xlSheet.Cells(14, 4) = "=F12" : xlSheet.Cells(16, 2) = "PPN " & 稅金_nud.Value & "%" : xlSheet.Cells(15, 3) = "' : " xlSheet.Cells(15, 4) = 請款總額_nud.Value - 請款金額_nud.Value : xlSheet.Cells(16, 4) = "=D14+D15" xlSheet.Cells(17, 1) = "本期請款金額 Total Tagihan : Rp" : xlSheet.Cells(17, 3) = "' : " : xlSheet.Cells(17, 4) = "=D16" xlSheet.Cells(17, 7) = "元整" : xlSheet.Cells(17, 8) = "(含稅) Termasuk Ppn" : xlSheet.Cells(20, 2) = 客戶名稱_tb.Text : xlSheet.Cells(21, 2) = "驗收代表人" BB2(xlApp, xlSheet) End If If Strings.Left(合約編號_tb.Text, 2) = "HX" Then : CC(xlApp, xlSheet) : Else : DD(xlApp, xlSheet) : End If : FF(xlApp, xlSheet) End If '---------------------------------------------------------------------------------------------------------------------- If 主頁_ch.Checked = True Then xlSheet = NewMethod(xlBook) : xlApp.Sheets(1).Select : xlApp.Sheets(1).Name = "主頁" xlBook.Activate() : xlSheet.Activate() Dim BF As String If Strings.Left(合約編號_tb.Text, 2) = "HX" Then : BF = "PT HONG XHE INDUSTRIAL" & vbCrLf & "(鴻時工程有限公司)" Else : BF = "PT PUNCAK GEMILANG SEMESTA" & vbCrLf & "(鼎峰工程有限公司)" : End If Dim CF As String If 請款期數_cb.Text = "一" Then : CF = "第一次請款" & vbCrLf & "The First Installment of The Project Funds" ElseIf 請款期數_cb.Text = "二" Then : CF = "第二次請款" & vbCrLf & "The Second Installment of The Project Funds" ElseIf 請款期數_cb.Text = "三" Then : CF = "第三次請款" & vbCrLf & "The Third Installment of The Project Funds" ElseIf 請款期數_cb.Text = "四" Then : CF = "第四次請款" & vbCrLf & "The Fourth Installment of The Project Funds" ElseIf 請款期數_cb.Text = "五" Then : CF = "第五次請款" & vbCrLf & "The Fifth Installment of The Project Funds" End If xlSheet.Cells(2, 1) = "工程款撥付申請表" xlSheet.Cells(3, 1) = "Form Request Pembayaran Proyek Pembangunan" xlSheet.Cells(4, 1) = "客戶名稱 : " & vbCrLf & "Client's Name" : xlSheet.Cells(4, 2) = 客戶名稱_tb.Text xlSheet.Cells(5, 1) = "工程名稱:" & vbCrLf & "Nama Proyek" : xlSheet.Cells(5, 2) = 工程名稱_中_tb.Text & vbCrLf & 工程名稱_英_tb.Text xlSheet.Cells(6, 1) = "施工合同號:" & vbCrLf & "No. Kontrak Konstruksi" : xlSheet.Cells(6, 2) = 合約編號_tb.Text xlSheet.Cells(7, 1) = "施工單位:" & vbCrLf & "Perusahaan Konstruksi" : xlSheet.Cells(7, 2) = BF xlSheet.Cells(8, 1) = "付款專案:" & vbCrLf & "Proyek Pembayaran" : xlSheet.Cells(8, 2) = CF xlSheet.Cells(8, 5) = "合同總額 (未稅):" & vbCrLf & "Jumlah Total Kontrak" If 稅額顯示_lb.Text = "PPN 10%稅額 = Rp. " Then xlSheet.Cells(8, 6) = Strings.Format(ANUD2.Value / 1.1, "#,##0") Else xlSheet.Cells(8, 6) = Strings.Format(ANUD2.Value / 1.11, "#,##0") End If xlSheet.Cells(9, 1) = "請款單位:" & vbCrLf & "Departemen Pemohon" : xlSheet.Cells(9, 2) = BF xlSheet.Cells(9, 5) = "要求付款日期:" & vbCrLf & "Permintaan Tanggal Pembayaran" : xlSheet.Cells(9, 6) = 付款期限_cb.Text xlSheet.Cells(10, 1) = "本次請款金額 (未稅):" & vbCrLf & "Total Tagihan" : xlSheet.Cells(10, 2) = Strings.Format(請款金額_nud.Value, "#,##0") xlSheet.Cells(10, 5) = "累計已收金額 (未稅):" & vbCrLf & "Akumulasi Biaya yang Diterima" Dim 已請 As Long For I As Integer = 0 To 請款單_dgv.Rows.Count - 1 If 請款期數_cb.Text = "一" Then 已請 = 0 ElseIf 請款期數_cb.Text = "二" Then If 請款單_dgv.Rows(I).Cells("期數").Value.ToString = "一" Then 已請 = 已請 + 請款單_dgv.Rows(I).Cells("請款金額").Value End If ElseIf 請款期數_cb.Text = "三" Then If 請款單_dgv.Rows(I).Cells("期數").Value.ToString = "一" Or 請款單_dgv.Rows(I).Cells("期數").Value.ToString = "二" Then 已請 = 已請 + 請款單_dgv.Rows(I).Cells("請款金額").Value End If ElseIf 請款期數_cb.Text = "四" Then If 請款單_dgv.Rows(I).Cells("期數").Value.ToString = "一" Or 請款單_dgv.Rows(I).Cells("期數").Value.ToString = "二" Or 請款單_dgv.Rows(I).Cells("期數").Value.ToString = "三" Then 已請 = 已請 + 請款單_dgv.Rows(I).Cells("請款金額").Value End If ElseIf 請款期數_cb.Text = "五" Then If 請款單_dgv.Rows(I).Cells("期數").Value.ToString = "一" Or 請款單_dgv.Rows(I).Cells("期數").Value.ToString = "二" Or 請款單_dgv.Rows(I).Cells("期數").Value.ToString = "三" Or 請款單_dgv.Rows(I).Cells("期數").Value.ToString = "四" Then 已請 = 已請 + 請款單_dgv.Rows(I).Cells("請款金額").Value End If End If Next xlSheet.Cells(10, 6) = Strings.Format(已請, "#,##0") xlSheet.Cells(11, 1) = "本次請款內容:" & vbCrLf & "Deskripsi Tagihan" : xlSheet.Cells(11, 2) = 請款內容_tb.Text If 主頁明細_ch.Checked = True Then xlSheet.Cells(14, 2) = "合約金額(Contract Amount) : " If 稅額顯示_lb.Text = "PPN 10%稅額 = Rp. " Then xlSheet.Cells(14, 4) = Strings.Format(ANUD1.Value / 1.1, "#,##0") Else xlSheet.Cells(14, 4) = Strings.Format(ANUD1.Value / 1.11, "#,##0") End If : xlSheet.Cells(14, 5) = " RP (未稅)" xlSheet.Cells(15, 2) = "結算金額(Settlement Amount) : " If 稅額顯示_lb.Text = "PPN 10%稅額 = Rp. " Then xlSheet.Cells(15, 4) = Strings.Format(ANUD2.Value / 1.1, "#,##0") Else xlSheet.Cells(15, 4) = Strings.Format(ANUD2.Value / 1.11, "#,##0") End If : xlSheet.Cells(15, 5) = " RP (未稅)" xlSheet.Cells(16, 2) = "實際追加減(Add To) : " If 稅額顯示_lb.Text = "PPN 10%稅額 = Rp. " Then xlSheet.Cells(16, 4) = Strings.Format(ANUD3.Value / 1.1, "#,##0") Else xlSheet.Cells(16, 4) = Strings.Format(ANUD3.Value / 1.11, "#,##0") End If : xlSheet.Cells(16, 5) = " RP (未稅)" xlSheet.Cells(17, 2) = "已請款(Requested) : " : xlSheet.Cells(17, 4) = Strings.Format(已請, "#,##0") : xlSheet.Cells(17, 5) = " RP (未稅)" xlSheet.Cells(18, 2) = "剩餘款(Remaining) : " : xlSheet.Cells(18, 4) = "=D15-D17" : xlSheet.Cells(18, 5) = " RP (未稅)" xlSheet.Cells(19, 2) = "其中:" If 請款期數_cb.Text = "四" Then : xlSheet.Cells(20, 2) = "驗收款(Final acceptance) : " : Else : xlSheet.Cells(20, 2) = "未收款(Unpaid) : " : End If xlSheet.Cells(20, 4) = "=D15-D17-D21" : xlSheet.Cells(20, 5) = " RP (未稅)" xlSheet.Cells(21, 2) = "保留款(Assure) : " : xlSheet.Cells(21, 4) = "= D15 * " & 工程款5_nud.Value & "/ 100" : xlSheet.Cells(21, 5) = " RP (未稅)" End If xlSheet.Cells(23, 3) = "申請人 Pemohon:" : xlSheet.Cells(23, 4) = BF xlSheet.Cells(25, 3) = "申請時間 Waktu:" : xlSheet.Cells(25, 4) = Strings.Format(申請日期_dtp.Value, "yyyy/MM/dd") xlSheet.Cells(26, 1) = "籌建辦審批意見:" & vbCrLf & "Komentar Penyetuju Kantor Konstruksi Umum" : xlSheet.Cells(26, 2) = 其他意見_tb.Text xlSheet.Cells(36, 3) = "審核人 Disetujui oleh:" : xlSheet.Cells(37, 3) = "審核時間 Waktu:" xlSheet.Cells(39, 1) = "本表一式三份:施工單位、籌建辦、財務單位各一份。" xlSheet.Cells(40, 1) = "Form ini dirangkap 3 lembar: Perusahaan konstruksi, kantor konstruksi umum, departemen finance" AA(xlApp, xlSheet) If 甲方_tb.Text = "JCS" Then : JCS(xlApp, xlSheet) : ElseIf 甲方_tb.Text = "J2" Then : J2(xlApp, xlSheet) : Else If Strings.Left(合約編號_tb.Text, 2) = "HX" Then : CC(xlApp, xlSheet) : Else : DD(xlApp, xlSheet) : End If : FF(xlApp, xlSheet) End If End If If 報告移交單_ch.Checked = True And 請款單_ch.Checked = True And 主頁_ch.Checked = True Then : xlApp.Sheets(4).Delete ElseIf 報告移交單_ch.Checked = True And 請款單_ch.Checked = True And 主頁_ch.Checked = False Then : xlApp.Sheets(3).Delete ElseIf 報告移交單_ch.Checked = True And 請款單_ch.Checked = False And 主頁_ch.Checked = True Then : xlApp.Sheets(3).Delete ElseIf 報告移交單_ch.Checked = False And 請款單_ch.Checked = True And 主頁_ch.Checked = True Then : xlApp.Sheets(3).Delete ElseIf 報告移交單_ch.Checked = True And 請款單_ch.Checked = False And 主頁_ch.Checked = False Then : xlApp.Sheets(2).Delete ElseIf 報告移交單_ch.Checked = False And 請款單_ch.Checked = True And 主頁_ch.Checked = False Then : xlApp.Sheets(2).Delete ElseIf 報告移交單_ch.Checked = False And 請款單_ch.Checked = False And 主頁_ch.Checked = True Then : xlApp.Sheets(2).Delete End If xlSheet.PageSetup.PrintArea = "" xlApp.Cells.Select() xlApp.Application.WindowState = xlMinimized If 系統語言 = "繁體中文" Then : MsgBox("列印完成!!") : Else : MsgBox("cetak selesai!!") : End If Catch ex As Exception MsgBox(ex.Message) End Try End If End If End If End If End If 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 = 95 xlSheet.Rows("2:3").Select With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 18 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 30 : xlSheet.Columns("B:D").Select : myExcel.Selection.ColumnWidth = 15 xlSheet.Columns("E:E").Select : myExcel.Selection.ColumnWidth = 30 : xlSheet.Columns("F:F").Select : myExcel.Selection.ColumnWidth = 15 xlSheet.Rows("4:7").Select : myExcel.Selection.RowHeight = 40 xlSheet.Range("B4:F4").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 With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("B5:F5").Select() : With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("B6:F6").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 With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("B7:F7").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("A2:F2").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("A3:F3").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.Rows("8:10").Select : myExcel.Selection.RowHeight = 40 xlSheet.Range("B8:D8").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("B9:D9").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("B10:D10").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("F8:F10").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With xlSheet.Range("B11:F12").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 With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("A11:A25").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge xlSheet.Range("D24:F24").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Rows("24:24").Select : myExcel.Selection.RowHeight = 13.5 xlSheet.Range("C24").Select() With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With xlSheet.Range("C25").Select() With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With xlSheet.Range("D25").Select() With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With xlSheet.Rows("26:26").Select : myExcel.Selection.RowHeight = 13.5 xlSheet.Range("A26:A37").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("A11:A25").Select() With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("B26:F35").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("C36").Select() With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With xlSheet.Range("C37").Select() With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With xlSheet.Range("A4:F10").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 xlSheet.Range("B11:F25").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 myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Range("A11:A25").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 myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Range("A26:A37").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 myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Range("B26:F37").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 myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Range("A4:F37").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 = xlMedium : End With With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With xlSheet.Range("A38:F41").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 = xlMedium : End With With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone myExcel.ActiveWindow.DisplayGridlines = False xlSheet.Range("D23:F24").Select() With myExcel.Selection : .HorizontalAlignment = xlGeneral : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.UnMerge With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("D21").Select() : myExcel.Selection.NumberFormatLocal = "#,##0" xlSheet.Range("I6").Select() End Sub Private Sub BB(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.Range("D15:F18").Select() With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 14 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 5 : xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 40 xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 6 : xlSheet.Columns("D:D").Select : myExcel.Selection.ColumnWidth = 17 xlSheet.Columns("E:E").Select : myExcel.Selection.ColumnWidth = 6 : xlSheet.Columns("F:F").Select : myExcel.Selection.ColumnWidth = 17 xlSheet.Columns("G:G").Select : myExcel.Selection.ColumnWidth = 6 : xlSheet.Columns("H:H").Select : myExcel.Selection.ColumnWidth = 17 xlSheet.Columns("I:I").Select : myExcel.Selection.ColumnWidth = 10 xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 95 : xlSheet.Rows("3:3").Select : myExcel.Selection.RowHeight = 30 xlSheet.Rows("4:4").Select : myExcel.Selection.RowHeight = 50 : xlSheet.Rows("5:5").Select : myExcel.Selection.RowHeight = 25 xlSheet.Rows("7:7").Select : myExcel.Selection.RowHeight = 40 : xlSheet.Rows("8:12").Select : myExcel.Selection.RowHeight = 30 xlSheet.Rows("13:13").Select : myExcel.Selection.RowHeight = 30 : xlSheet.Rows("14:21").Select : myExcel.Selection.RowHeight = 30 xlSheet.Rows("23:23").Select : myExcel.Selection.RowHeight = 120 xlSheet.Range("A2:I2").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 With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 22 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With myExcel.Selection.Font.Underline = xlUnderlineStyleSingle xlSheet.Range("A3:G3").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 With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("H3:I3").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 With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("A4:G4").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 With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With With myExcel.Selection : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False .ReadingOrder = xlContext : End With xlSheet.Range("H4:I4").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("A5:D5").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 With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("E5:I5").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 myExcel.Selection.NumberFormatLocal = "#,##0" xlSheet.Range("E7:F7").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge xlSheet.Range("G7:H7").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge xlSheet.Range("A7:I7").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : End With xlSheet.Range("A8:A12").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With xlSheet.Range("A8:B12").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With xlSheet.Range("C8:C12").Select() : myExcel.Selection.Style = "Percent" xlSheet.Range("E8:E13").Select() : myExcel.Selection.Style = "Percent" xlSheet.Range("G8:G13").Select() : myExcel.Selection.Style = "Percent" xlSheet.Range("D8:D18").Select() : myExcel.Selection.NumberFormatLocal = "#,##0" xlSheet.Range("F8:F13").Select() : myExcel.Selection.NumberFormatLocal = "#,##0" xlSheet.Range("H8:H13").Select() : myExcel.Selection.NumberFormatLocal = "#,##0" xlSheet.Range("A13:C13").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("B15:B16").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With xlSheet.Range("D15:E15").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("D16:E16").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("D17:E17").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("D18:F18").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("B21:D21").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("B22:D22").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("A3:I4").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 = xlMedium : End With With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Range("A5:I5").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 = xlMedium : End With With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Range("A7:I7").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 = xlMedium : End With With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : 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.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone xlSheet.Range("A8:I12").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 = xlMedium : End With With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : 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.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone xlSheet.Range("A13:I13").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 = xlMedium : End With With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : 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.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone xlSheet.Range("B16:E16").Select() myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Range("D18:F18").Select() myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Range("A14:I23").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 = xlMedium : End With With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone xlSheet.Range("J16").Select() : myExcel.ActiveWindow.DisplayGridlines = False xlSheet.Range("C7:D12").Select() : With myExcel.Selection.Font : .ThemeColor = xlThemeColorAccent6 : .TintAndShade = 0 : End With xlSheet.Range("D13").Select() : With myExcel.Selection.Font : .ThemeColor = xlThemeColorAccent6 : .TintAndShade = 0 : End With xlSheet.Range("E7:F13").Select() : With myExcel.Selection.Font : .Color = -16776961 : .TintAndShade = 0 : End With xlSheet.Range("G7:H13").Select() : With myExcel.Selection.Font : .ThemeColor = xlThemeColorAccent1 : .TintAndShade = 0 : End With xlSheet.Range("A7:I13").Select() : myExcel.Selection.Font.Bold = True End Sub Private Sub BB2(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.Range("D14:F17").Select() With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 14 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 5 : xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 40 xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 6 : xlSheet.Columns("D:D").Select : myExcel.Selection.ColumnWidth = 17 xlSheet.Columns("E:E").Select : myExcel.Selection.ColumnWidth = 6 : xlSheet.Columns("F:F").Select : myExcel.Selection.ColumnWidth = 17 xlSheet.Columns("G:G").Select : myExcel.Selection.ColumnWidth = 6 : xlSheet.Columns("H:H").Select : myExcel.Selection.ColumnWidth = 17 xlSheet.Columns("I:I").Select : myExcel.Selection.ColumnWidth = 10 xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 95 : xlSheet.Rows("3:3").Select : myExcel.Selection.RowHeight = 30 xlSheet.Rows("4:4").Select : myExcel.Selection.RowHeight = 50 : xlSheet.Rows("5:5").Select : myExcel.Selection.RowHeight = 25 xlSheet.Rows("7:7").Select : myExcel.Selection.RowHeight = 40 : xlSheet.Rows("8:11").Select : myExcel.Selection.RowHeight = 30 xlSheet.Rows("12:12").Select : myExcel.Selection.RowHeight = 30 : xlSheet.Rows("13:20").Select : myExcel.Selection.RowHeight = 30 xlSheet.Rows("22:22").Select : myExcel.Selection.RowHeight = 120 xlSheet.Range("A2:I2").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 With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 22 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With myExcel.Selection.Font.Underline = xlUnderlineStyleSingle xlSheet.Range("A3:G3").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 With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("H3:I3").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 With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("A4:G4").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 With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With With myExcel.Selection : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False .ReadingOrder = xlContext : End With xlSheet.Range("H4:I4").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("A5:D5").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 With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("E5:I5").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 myExcel.Selection.NumberFormatLocal = "#,##0" xlSheet.Range("E7:F7").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge xlSheet.Range("G7:H7").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge xlSheet.Range("A7:I7").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : End With xlSheet.Range("A8:A11").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With xlSheet.Range("A8:B11").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With xlSheet.Range("C8:C11").Select() : myExcel.Selection.Style = "Percent" xlSheet.Range("E8:E12").Select() : myExcel.Selection.Style = "Percent" xlSheet.Range("G8:G12").Select() : myExcel.Selection.Style = "Percent" xlSheet.Range("D8:D17").Select() : myExcel.Selection.NumberFormatLocal = "#,##0" xlSheet.Range("F8:F12").Select() : myExcel.Selection.NumberFormatLocal = "#,##0" xlSheet.Range("H8:H12").Select() : myExcel.Selection.NumberFormatLocal = "#,##0" xlSheet.Range("A12:C12").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("B14:B15").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With xlSheet.Range("D14:E14").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("D15:E15").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("D16:E16").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("D17:F17").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("B20:D20").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("B21:D21").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("A3:I4").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 = xlMedium : End With With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Range("A5:I5").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 = xlMedium : End With With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Range("A7:I7").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 = xlMedium : End With With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : 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.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone xlSheet.Range("A8:I11").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 = xlMedium : End With With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : 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.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone xlSheet.Range("A12:I12").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 = xlMedium : End With With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : 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.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone xlSheet.Range("B15:E15").Select() myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Range("D17:F17").Select() myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Range("A13:I22").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 = xlMedium : End With With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone xlSheet.Range("J16").Select() : myExcel.ActiveWindow.DisplayGridlines = False xlSheet.Range("C7:D11").Select() : With myExcel.Selection.Font : .ThemeColor = xlThemeColorAccent6 : .TintAndShade = 0 : End With xlSheet.Range("D12").Select() : With myExcel.Selection.Font : .ThemeColor = xlThemeColorAccent6 : .TintAndShade = 0 : End With xlSheet.Range("E7:F12").Select() : With myExcel.Selection.Font : .Color = -16776961 : .TintAndShade = 0 : End With xlSheet.Range("G7:H12").Select() : With myExcel.Selection.Font : .ThemeColor = xlThemeColorAccent1 : .TintAndShade = 0 : End With xlSheet.Range("A7:I12").Select() : myExcel.Selection.Font.Bold = True End Sub Private Sub AB(ByVal myExcel As Application, ByVal xlSheet As Worksheet) Dim 位置 As String xlSheet.Cells.Select() With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 12 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 5 : xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 30 xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 3 : xlSheet.Columns("D:E").Select : myExcel.Selection.ColumnWidth = 40 xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 95 xlSheet.Range("A2:E2").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 With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 18 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With myExcel.Selection.Font.Underline = xlUnderlineStyleSingle xlSheet.Range("A4:E4").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 With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("A6:B6").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 With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("C6:E6").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 With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("A7:B7").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 With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Rows("7:7").Select : myExcel.Selection.RowHeight = 30 xlSheet.Range("C7:E7").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 With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("A9:E9").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 With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("A6:B7").Select() With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : End With xlSheet.Range("A11:B11").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 With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("A12:B12").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 With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("C11:E11").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 With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Rows("12:12").Select : myExcel.Selection.RowHeight = 30 xlSheet.Range("C12:E12").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 With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("A14:E14").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 With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With If 請款期數_cb.Text = "四" Then : 位置 = "D16:D21" : Else : 位置 = "D16:D20" : End If : xlSheet.Range(位置).Select() With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With If 請款期數_cb.Text = "四" Then : 位置 = "C16:C21" : Else : 位置 = "C16:C20" : End If : xlSheet.Range(位置).Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With If 請款期數_cb.Text = "四" Then xlSheet.Rows("23:23").Select : myExcel.Selection.RowHeight = 30 xlSheet.Range("A23:E23").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 With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With Else : End If If 請款期數_cb.Text = "四" Then xlSheet.Rows("24:24").Select : myExcel.Selection.RowHeight = 30 : 位置 = "A24:E24" : xlSheet.Range(位置).Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With Else xlSheet.Rows("22:22").Select : myExcel.Selection.RowHeight = 30 : 位置 = "A22:E22" : xlSheet.Range(位置).Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With End If If 請款期數_cb.Text = "四" Then : 位置 = "A25:E25" : Else : 位置 = "A23:E23" : End If : xlSheet.Range(位置).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 With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With If 請款期數_cb.Text = "四" Then : xlSheet.Range("D27").Select() : Else : xlSheet.Range("D25").Select() : End If With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With If 請款期數_cb.Text = "四" Then : xlSheet.Range("E27").Select() : Else : xlSheet.Range("E25").Select() : End If With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With If 請款期數_cb.Text = "四" Then : xlSheet.Range("E29:E31").Select() : Else : xlSheet.Range("E27:E29").Select() : End If With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With If 請款期數_cb.Text = "四" Then : xlSheet.Range("B31:D31").Select() : Else : xlSheet.Range("B29:D29").Select() : End If 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 With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With If 請款期數_cb.Text = "四" Then : xlSheet.Range("B30").Select() : Else : xlSheet.Range("B28").Select() : End If With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With If 請款期數_cb.Text = "四" Then : xlSheet.Rows("32:32").Select : Else : xlSheet.Rows("30:30").Select : End If : myExcel.Selection.RowHeight = 100 myExcel.ActiveWindow.DisplayGridlines = False End Sub Private Sub CC(ByVal myExcel As Application, ByVal xlSheet As Worksheet) Clipboard.SetDataObject(PictureBox1.Image) xlSheet.Range("A1").Select() myExcel.ActiveSheet.Pictures.Paste.Select myExcel.Selection.ShapeRange.Height = 93 myExcel.Selection.ShapeRange.IncrementLeft(0) myExcel.Selection.ShapeRange.IncrementTop(0) End Sub Private Sub DD(ByVal myExcel As Application, ByVal xlSheet As Worksheet) Clipboard.SetDataObject(PictureBox2.Image) xlSheet.Range("A1").Select() myExcel.ActiveSheet.Pictures.Paste.Select myExcel.Selection.ShapeRange.Height = 93 myExcel.Selection.ShapeRange.IncrementLeft(0) myExcel.Selection.ShapeRange.IncrementTop(0) End Sub Private Sub JCS(ByVal myExcel As Application, ByVal xlSheet As Worksheet) Clipboard.SetDataObject(JCS_PB.Image) xlSheet.Range("A1").Select() myExcel.ActiveSheet.Pictures.Paste.Select myExcel.Selection.ShapeRange.Height = 93 myExcel.Selection.ShapeRange.IncrementLeft(0) myExcel.Selection.ShapeRange.IncrementTop(0) End Sub Private Sub J2(ByVal myExcel As Application, ByVal xlSheet As Worksheet) Clipboard.SetDataObject(J2_PB.Image) xlSheet.Range("A1").Select() myExcel.ActiveSheet.Pictures.Paste.Select myExcel.Selection.ShapeRange.Height = 93 myExcel.Selection.ShapeRange.IncrementLeft(0) myExcel.Selection.ShapeRange.IncrementTop(0) End Sub Private Sub FF(ByVal myExcel As Application, ByVal xlSheet As Worksheet) myExcel.Application.PrintCommunication = False : With myExcel.ActiveSheet.PageSetup : .PrintTitleRows = "" : .PrintTitleColumns = "" : End With myExcel.Application.PrintCommunication = True : myExcel.ActiveSheet.PageSetup.PrintArea = "" : myExcel.Application.PrintCommunication = False With myExcel.ActiveSheet.PageSetup : .LeftHeader = "" : .CenterHeader = "" : .RightHeader = "" : .LeftFooter = "" : .CenterFooter = "第 &P 頁,共 &N 頁" : .RightFooter = "" .LeftMargin = myExcel.Application.InchesToPoints(0.236220472440945) : .RightMargin = myExcel.Application.InchesToPoints(0.236220472440945) .TopMargin = myExcel.Application.InchesToPoints(0.748031496062992) : .BottomMargin = myExcel.Application.InchesToPoints(0.748031496062992) .HeaderMargin = myExcel.Application.InchesToPoints(0.31496062992126) : .FooterMargin = myExcel.Application.InchesToPoints(0.31496062992126) .PrintHeadings = False : .PrintGridlines = False : .CenterHorizontally = True : .CenterVertically = False : .Draft = False .FirstPageNumber = xlAutomatic : .BlackAndWhite = False : .Zoom = False : .FitToPagesWide = 1 : .FitToPagesTall = False : .OddAndEvenPagesHeaderFooter = False .DifferentFirstPageHeaderFooter = False : .ScaleWithDocHeaderFooter = True : .AlignMarginsHeaderFooter = True .EvenPage.LeftHeader.Text = "" : .EvenPage.CenterHeader.Text = "" : .EvenPage.RightHeader.Text = "" : .EvenPage.LeftFooter.Text = "" .EvenPage.CenterFooter.Text = "" : .EvenPage.RightFooter.Text = "" : .FirstPage.LeftHeader.Text = "" : .FirstPage.CenterHeader.Text = "" .FirstPage.RightHeader.Text = "" : .FirstPage.LeftFooter.Text = "" : .FirstPage.CenterFooter.Text = "" : .FirstPage.RightFooter.Text = "" End With : myExcel.Application.PrintCommunication = True End Sub End Class