Aucune description
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

列印_生產進度表.vb 27KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. Option Strict Off
  2. Imports System.Data.SqlClient
  3. Imports Microsoft.Office.Interop.Excel.XlUnderlineStyle
  4. Imports Microsoft.Office.Interop.Excel.Constants
  5. Imports Microsoft.Office.Interop.Excel.XlBordersIndex
  6. Imports Microsoft.Office.Interop.Excel.XlLineStyle
  7. Imports Microsoft.Office.Interop.Excel.XlBorderWeight
  8. Imports Microsoft.Office.Interop.Excel.XlThemeFont
  9. Imports Microsoft.Office.Interop.Excel.XlThemeColor
  10. Imports Microsoft.Office.Interop.Excel.XlWindowState
  11. Imports Microsoft.Office.Interop.Excel
  12. Public Class 列印_生產進度表
  13. ReadOnly conn As New SqlConnection
  14. ReadOnly da As New SqlDataAdapter
  15. ReadOnly cmd As New SqlCommand
  16. ReadOnly ds As New DataSet
  17. Dim xlApp As Application
  18. Dim xlBook As Workbook
  19. Dim xlSheet As Worksheet
  20. Public Property ThisWorkbook As Object
  21. Public Property ActiveWorkbook As Object
  22. Dim N1 As Integer = 0
  23. Private Sub Set_DGV1載入前設定()
  24. DataGridView1.DataSource = Nothing : ds.Clear()
  25. DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  26. DataGridView1.ColumnHeadersHeight = 25
  27. DataGridView1.AllowUserToAddRows = False
  28. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  29. End Sub
  30. Private Sub Set_DGV1載入後設定()
  31. cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : da.Fill(ds) : DataGridView1.DataSource = ds.Tables(0) : conn.Close()
  32. End Sub
  33. Private Sub Set_訂單清單()
  34. Set_DGV1載入前設定()
  35. SQL1 = "SELECT 訂單明細表抬頭.下單日 AS 接單日, 訂單控制表.訂單流水號, 訂單控制表.客戶訂單號,
  36. 訂單控制表.GOODBOX AS 型體名稱, 訂單控制表.型體號碼, 訂單控制表.年份季度, 訂單控制表.TVW AS 楦型,
  37. 訂單控制表.APMA確認 AS 顏色, 訂單控制表.訂單數量, 訂單控制表.工廠回復交期 AS 最後交期, 訂單控制表.BUYER,
  38. 訂單控制表.材質, 訂單控制表.東莞業務備註, 訂單控制表.LEATHER AS 手剪全套, 訂單控制表.LEA_Note AS 斬刀全套,
  39. 訂單控制表.面料, 訂單控制表.副料, 訂單控制表.中底, 訂單控制表.鞋墊, 訂單控制表.大底, 訂單控制表.跟,
  40. 訂單控制表.包裝確認時間 AS 包裝, 訂單控制表.裁斷時間 AS 裁斷, 訂單控制表.針車時間 AS 針車,
  41. 訂單控制表.成型時間 AS 成形, 訂單控制表.驗貨時間 AS 驗貨, 訂單控制表.工廠進度表備註1 AS 驗貨結果,
  42. 訂單控制表.工廠進度表備註2 AS 工廠備註, 訂單控制表.驗貨報告圖片
  43. FROM 訂單控制表 LEFT OUTER JOIN
  44. 訂單明細表抬頭 ON 訂單控制表.客戶訂單號 = 訂單明細表抬頭.客戶訂單號 AND
  45. 訂單控制表.訂單流水號 = 訂單明細表抬頭.訂單流水號
  46. WHERE (訂單控制表.CXL = 0 OR
  47. 訂單控制表.CXL IS NULL) AND (訂單控制表.訂單數量 - 訂單控制表.出貨數量 <> 0)
  48. ORDER BY 訂單控制表.訂單流水號 DESC, 訂單控制表.客戶交期1, 訂單控制表.型體號碼, 顏色, 楦型"
  49. Set_DGV1載入後設定()
  50. End Sub
  51. Private Sub 生產進度表列印_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  52. FormBorderStyle = FormBorderStyle.SizableToolWindow : ControlBox = False
  53. CheckBox1.Visible = False : CheckBox3.Visible = False : CheckBox6.Visible = False : CheckBox5.Visible = False : CheckBox4.Visible = False
  54. Set_訂單清單()
  55. End Sub
  56. Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
  57. xlApp = CType(CreateObject("Excel.Application"), Application)
  58. xlApp.Visible = True
  59. xlApp.DisplayAlerts = True
  60. xlApp.Application.WindowState = xlMaximized
  61. xlBook = xlApp.Workbooks.Add
  62. xlSheet = NewMethod(xlBook)
  63. xlApp.Sheets(1).Select
  64. xlBook.Activate() : xlSheet.Activate()
  65. xlApp.Sheets(1).Name = "SK"
  66. xlSheet.Range("A1").Select()
  67. xlSheet.Cells(1, 13) = "淺藍色欄位為系統輸出,請勿做任何更改
  68. 淺綠色欄位為巨益辦公室填入"
  69. xlSheet.Cells(2, 14) = "量產樣品" : xlSheet.Cells(2, 16) = "PRODUCTION"
  70. xlSheet.Cells(3, 1) = "接單日" : xlSheet.Cells(3, 2) = "巨益PO#" : xlSheet.Cells(3, 3) = "客戶PO#" : xlSheet.Cells(3, 4) = "型體名稱"
  71. xlSheet.Cells(3, 5) = "型體號碼" : xlSheet.Cells(3, 6) = "年份季度" : xlSheet.Cells(3, 7) = "楦型" : xlSheet.Cells(3, 8) = "顏色"
  72. xlSheet.Cells(3, 9) = "訂單數" : xlSheet.Cells(3, 10) = "最後交期" : xlSheet.Cells(3, 11) = "BUYER" : xlSheet.Cells(3, 12) = "材質"
  73. xlSheet.Cells(3, 13) = "東莞業務備註" : xlSheet.Cells(3, 14) = "手剪全套" : xlSheet.Cells(3, 15) = "斬刀全套"
  74. xlSheet.Cells(3, 16) = "面料" : xlSheet.Cells(3, 17) = "副料" : xlSheet.Cells(3, 18) = "中底" : xlSheet.Cells(3, 19) = "鞋墊" : xlSheet.Cells(3, 20) = "大底"
  75. xlSheet.Cells(3, 21) = "跟" : xlSheet.Cells(3, 22) = "包裝" : xlSheet.Cells(3, 23) = "裁斷" : xlSheet.Cells(3, 24) = "針車" : xlSheet.Cells(3, 25) = "成型"
  76. xlSheet.Cells(3, 26) = "驗貨" : xlSheet.Cells(3, 27) = "驗貨結果" : xlSheet.Cells(3, 28) = "工廠備註"
  77. For i As Integer = 0 To DataGridView1.Rows.Count - 1
  78. xlSheet.Cells(i + 4, 1) = DataGridView1.Rows(i).Cells("接單日").Value : xlSheet.Cells(i + 4, 2) = DataGridView1.Rows(i).Cells("訂單流水號").Value
  79. xlSheet.Cells(i + 4, 3) = DataGridView1.Rows(i).Cells("客戶訂單號").Value : xlSheet.Cells(i + 4, 4) = DataGridView1.Rows(i).Cells("型體名稱").Value
  80. xlSheet.Cells(i + 4, 5) = DataGridView1.Rows(i).Cells("型體號碼").Value : xlSheet.Cells(i + 4, 6) = DataGridView1.Rows(i).Cells("年份季度").Value
  81. xlSheet.Cells(i + 4, 7) = DataGridView1.Rows(i).Cells("楦型").Value : xlSheet.Cells(i + 4, 8) = DataGridView1.Rows(i).Cells("顏色").Value
  82. xlSheet.Cells(i + 4, 9) = DataGridView1.Rows(i).Cells("訂單數量").Value : xlSheet.Cells(i + 4, 10) = DataGridView1.Rows(i).Cells("最後交期").Value
  83. xlSheet.Cells(i + 4, 11) = DataGridView1.Rows(i).Cells("BUYER").Value
  84. xlSheet.Cells(i + 4, 12) = DataGridView1.Rows(i).Cells("材質").Value
  85. xlSheet.Cells(i + 4, 13) = DataGridView1.Rows(i).Cells("東莞業務備註").Value
  86. xlSheet.Cells(i + 4, 14) = DataGridView1.Rows(i).Cells("手剪全套").Value
  87. xlSheet.Cells(i + 4, 15) = DataGridView1.Rows(i).Cells("斬刀全套").Value
  88. xlSheet.Cells(i + 4, 16) = DataGridView1.Rows(i).Cells("面料").Value : xlSheet.Cells(i + 4, 17) = DataGridView1.Rows(i).Cells("副料").Value
  89. xlSheet.Cells(i + 4, 18) = DataGridView1.Rows(i).Cells("中底").Value : xlSheet.Cells(i + 4, 19) = DataGridView1.Rows(i).Cells("鞋墊").Value
  90. xlSheet.Cells(i + 4, 20) = DataGridView1.Rows(i).Cells("大底").Value : xlSheet.Cells(i + 4, 21) = DataGridView1.Rows(i).Cells("跟").Value
  91. xlSheet.Cells(i + 4, 22) = DataGridView1.Rows(i).Cells("包裝").Value : xlSheet.Cells(i + 4, 23) = DataGridView1.Rows(i).Cells("裁斷").Value
  92. xlSheet.Cells(i + 4, 24) = DataGridView1.Rows(i).Cells("針車").Value : xlSheet.Cells(i + 4, 25) = DataGridView1.Rows(i).Cells("成形").Value
  93. xlSheet.Cells(i + 4, 26) = DataGridView1.Rows(i).Cells("驗貨").Value : xlSheet.Cells(i + 4, 27) = DataGridView1.Rows(i).Cells("驗貨結果").Value
  94. xlSheet.Cells(i + 4, 28) = DataGridView1.Rows(i).Cells("工廠備註").Value
  95. With xlApp.Selection
  96. .Font.Bold = True
  97. End With
  98. N1 = i
  99. Next i
  100. BB(xlApp, xlSheet)
  101. xlSheet.Range("A4").Select()
  102. If xlApp.Sheets(2).Name = "工作表1" Then
  103. xlApp.Sheets("工作表1").Delete
  104. Else
  105. xlApp.Sheets("sheet1").Delete
  106. End If
  107. xlSheet.Cells(1, 1) = "巨益 量產進度管理表"
  108. xlSheet.PageSetup.PrintArea = ""
  109. xlApp.Cells.Select()
  110. xlApp.Application.WindowState = xlMinimized
  111. MsgBox("列印完成")
  112. Me.Close()
  113. End Sub
  114. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  115. Me.Close()
  116. End Sub
  117. Private Shared Function NewMethod(xlBook As Microsoft.Office.Interop.Excel.Workbook) As Microsoft.Office.Interop.Excel.Worksheet
  118. Return CType(xlBook.Worksheets.Add, Worksheet)
  119. End Function
  120. Private Sub BB(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  121. xlSheet.Cells.Select()
  122. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False
  123. .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  124. xlSheet.Range("A1:L1").Select()
  125. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 24 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False
  126. .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  127. xlSheet.Range("A2:A3").Select()
  128. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  129. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  130. xlSheet.Range("B2:B3").Select()
  131. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  132. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  133. xlSheet.Range("C2:C3").Select()
  134. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  135. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  136. xlSheet.Range("D2:D3").Select()
  137. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  138. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  139. xlSheet.Range("E2:E3").Select()
  140. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  141. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  142. xlSheet.Range("F2:F3").Select()
  143. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  144. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  145. xlSheet.Range("G2:G3").Select()
  146. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  147. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  148. xlSheet.Range("H2:H3").Select()
  149. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  150. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  151. xlSheet.Range("I2:I3").Select()
  152. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  153. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  154. xlSheet.Range("J2:J3").Select()
  155. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  156. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  157. xlSheet.Range("K2:K3").Select()
  158. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  159. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  160. xlSheet.Range("L2:L3").Select()
  161. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  162. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  163. xlSheet.Range("M2").Select()
  164. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  165. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  166. xlSheet.Range("N2:O2").Select()
  167. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  168. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  169. xlSheet.Range("P2:AB2").Select()
  170. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  171. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  172. xlSheet.Rows("2:3").Select
  173. With myExcel.Selection : .VerticalAlignment = xlTop : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  174. .ReadingOrder = xlContext : End With
  175. xlSheet.Rows("2:3").Select : myExcel.Selection.RowHeight = 25
  176. xlSheet.Rows("3:3").Select : myExcel.Selection.AutoFilter
  177. xlSheet.Rows("4:" & N1 + 5).Select
  178. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 9 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False
  179. .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  180. With myExcel.Selection : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : End With
  181. xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 9 : myExcel.Selection.NumberFormatLocal = "yyyy/mm/dd"
  182. With myExcel.Selection : .HorizontalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  183. .ReadingOrder = xlContext : End With
  184. xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 10
  185. With myExcel.Selection : .HorizontalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  186. .ReadingOrder = xlContext : End With
  187. xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 11 : myExcel.Selection.NumberFormatLocal = "@"
  188. With myExcel.Selection : .HorizontalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  189. .ReadingOrder = xlContext : End With
  190. xlSheet.Columns("D:D").Select : myExcel.Selection.ColumnWidth = 11
  191. xlSheet.Columns("E:E").Select : myExcel.Selection.ColumnWidth = 10
  192. xlSheet.Columns("F:F").Select : myExcel.Selection.ColumnWidth = 9
  193. xlSheet.Columns("G:G").Select : myExcel.Selection.ColumnWidth = 5
  194. xlSheet.Columns("H:H").Select : myExcel.Selection.ColumnWidth = 10
  195. xlSheet.Columns("I:I").Select : myExcel.Selection.ColumnWidth = 6 : myExcel.Selection.NumberFormatLocal = "#,##0 "
  196. xlSheet.Columns("J:J").Select : myExcel.Selection.ColumnWidth = 9 : myExcel.Selection.NumberFormatLocal = "yyyy/mm/dd"
  197. With myExcel.Selection : .HorizontalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  198. .ReadingOrder = xlContext : End With
  199. xlSheet.Columns("K:K").Select : myExcel.Selection.ColumnWidth = 10
  200. xlSheet.Columns("L:L").Select : myExcel.Selection.ColumnWidth = 5
  201. xlSheet.Columns("M:M").Select : myExcel.Selection.ColumnWidth = 40
  202. xlSheet.Rows("4:" & N1 + 5).Select : myExcel.Selection.RowHeight = 40 : With myExcel.Selection : .WrapText = True : End With
  203. xlSheet.Columns("M:M").Select : myExcel.Selection.ColumnWidth = 12
  204. With myExcel.Selection : .HorizontalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  205. .ReadingOrder = xlContext : End With
  206. xlSheet.Columns("N:AA").Select : myExcel.Selection.ColumnWidth = 9
  207. xlSheet.Columns("N:N").Select
  208. With myExcel.Selection : .HorizontalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  209. .ReadingOrder = xlContext : End With
  210. xlSheet.Columns("O:O").Select
  211. With myExcel.Selection : .HorizontalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  212. .ReadingOrder = xlContext : End With
  213. xlSheet.Columns("M:AB").Select
  214. With myExcel.Selection : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : End With
  215. xlSheet.Columns("AB:AB").Select : myExcel.Selection.ColumnWidth = 9
  216. xlSheet.Range("A1:AB3").Select()
  217. With myExcel.Selection.Interior : .Pattern = xlSolid : .PatternColorIndex = xlAutomatic : .ThemeColor = xlThemeColorDark1 : .TintAndShade = -0.249977111117893 : .PatternTintAndShade = 0 : End With
  218. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  219. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  220. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  221. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  222. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  223. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  224. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  225. xlSheet.Range("A4:K" & N1 + 5).Select()
  226. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  227. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  228. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  229. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  230. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  231. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  232. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  233. With myExcel.Selection.Interior : .Pattern = xlSolid : .PatternColorIndex = xlAutomatic : .ThemeColor = xlThemeColorAccent1 : .TintAndShade = 0.799981688894314 : .PatternTintAndShade = 0 : End With
  234. xlSheet.Range("L4:M" & N1 + 5).Select()
  235. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  236. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  237. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  238. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  239. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  240. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  241. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  242. xlSheet.Columns("M:M").Select : myExcel.Selection.ColumnWidth = 40
  243. xlSheet.Range("L4:M" & N1 + 5).Select()
  244. With myExcel.Selection.Interior : .Pattern = xlSolid : .PatternColorIndex = xlAutomatic : .ThemeColor = xlThemeColorAccent6 : .TintAndShade = 0.799981688894314 : .PatternTintAndShade = 0 : End With
  245. xlSheet.Range("N4:AB" & N1 + 5).Select()
  246. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  247. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  248. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  249. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  250. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  251. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  252. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  253. xlSheet.Range("A1:L1").Select()
  254. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  255. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  256. xlSheet.Range("M1:AB1").Select()
  257. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  258. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  259. xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 40
  260. xlSheet.Range("M1:AB1").Select()
  261. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  262. .ReadingOrder = xlContext : .MergeCells = True : End With
  263. xlSheet.Range("L4").Select() : myExcel.ActiveWindow.FreezePanes = True
  264. myExcel.ActiveWindow.DisplayGridlines = False
  265. xlSheet.Range("M4:M" & N1 + 5).Select()
  266. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 7 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False
  267. .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  268. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : End With
  269. xlSheet.Range("M1:AB1").Select() : With myExcel.Selection.Font : .Color = -16776961 : .TintAndShade = 0 : End With
  270. xlSheet.Range("M2:M3").Select() : myExcel.Selection.Merge
  271. End Sub
  272. Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.Click
  273. If CheckBox1.Checked = True Then : CheckBox1.Checked = True
  274. CheckBox2.Checked = False : CheckBox3.Checked = False : CheckBox4.Checked = False : CheckBox5.Checked = False : CheckBox7.Checked = False : End If
  275. End Sub
  276. Private Sub CheckBox2_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox2.Click
  277. If CheckBox2.Checked = True Then : CheckBox2.Checked = True
  278. CheckBox1.Checked = False : CheckBox3.Checked = False : CheckBox4.Checked = False : CheckBox6.Checked = False : CheckBox7.Checked = False : End If
  279. End Sub
  280. Private Sub CheckBox3_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox3.Click
  281. If CheckBox3.Checked = True Then : CheckBox3.Checked = True
  282. CheckBox1.Checked = False : CheckBox2.Checked = False : CheckBox5.Checked = False : CheckBox6.Checked = False : CheckBox7.Checked = False : End If
  283. End Sub
  284. Private Sub CheckBox4_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox4.Click
  285. If CheckBox4.Checked = True Then : CheckBox4.Checked = True
  286. CheckBox1.Checked = False : CheckBox2.Checked = False : CheckBox5.Checked = False : CheckBox6.Checked = False : CheckBox7.Checked = False : End If
  287. End Sub
  288. Private Sub CheckBox5_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox5.Click
  289. If CheckBox5.Checked = True Then : CheckBox5.Checked = True
  290. CheckBox1.Checked = False : CheckBox3.Checked = False : CheckBox4.Checked = False : CheckBox6.Checked = False : CheckBox7.Checked = False : End If
  291. End Sub
  292. Private Sub CheckBox6_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox6.Click
  293. If CheckBox6.Checked = True Then : CheckBox6.Checked = True
  294. CheckBox2.Checked = False : CheckBox3.Checked = False : CheckBox4.Checked = False : CheckBox5.Checked = False : CheckBox7.Checked = False : End If
  295. End Sub
  296. Private Sub CheckBox7_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox7.Click
  297. If CheckBox7.Checked = True Then : CheckBox7.Checked = True
  298. CheckBox1.Checked = False : CheckBox2.Checked = False : CheckBox3.Checked = False : CheckBox4.Checked = False : CheckBox5.Checked = False : CheckBox6.Checked = False : End If
  299. End Sub
  300. End Class