暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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

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