説明なし
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

列印_量產訂單控制表.vb 40KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  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. Public Class 列印_量產訂單控制表
  12. Dim conn As New SqlConnection
  13. Dim da As New SqlDataAdapter
  14. Dim cmd As New SqlCommand
  15. Dim ds As New DataSet
  16. Dim dr As SqlDataReader
  17. Dim OPEXC(5) As Boolean
  18. Dim P As Integer = 0 : Dim R As Integer = 0 : Dim A As Integer = 0 : Dim Q As Integer = 0 : Dim G As Integer = 0 : Dim H As Integer = 0 : Dim J As Integer = 0
  19. Dim 位置1 As String : Dim 位置2 As String : Dim 位置3 As String : Dim 位置4 As String : Dim 位置5 As String : Dim 位置6 As String : Dim 位置7 As String
  20. Dim xlApp As Microsoft.Office.Interop.Excel.Application
  21. Dim xlBook As Microsoft.Office.Interop.Excel.Workbook
  22. Dim xlSheet As Microsoft.Office.Interop.Excel.Worksheet
  23. Dim SQL字串1 As String = "SELECT 訂單流水號, 年份季度, 客戶訂單號, 型體號碼, GOODBOX AS 型體名稱, APMA確認 AS 顏色, TVW AS 楦型, 訂單數量, 工廠回復交期 AS 工廠交期, 客戶交期 AS 交期開始,
  24. 客戶交期1 AS 交期結束, 單價, 總金額, 備註, 生產工廠, 訂單種類, BUYER, CFMSPEC AS 訂單屬性, 明細建檔, 材質, 東莞業務備註, LEATHER AS 手剪全套, LEA_Note AS 斬刀全套,
  25. 面料, 副料, 中底, 鞋墊, 大底, 跟, 包裝確認時間 AS 包裝, 裁斷時間, 針車時間, 成型時間, 驗貨時間, 工廠進度表備註1 AS 驗貨結果, 工廠進度表備註2 AS 工廠備註,
  26. 資料流水號, 實際離廠日, 出貨數量, CXL, CXLTime, 驗貨報告圖片,
  27. CFMSAMPLE, TRIAL1, TRIAL2, TRIAL3, TRIAL4, 貼標時間, PO_S_Date, Requested_XF, Confirm_XF, Revised_XF,
  28. Special_Packaging, Remarks, 出貨地, 楦頭號, 長期試穿, 七號模具, 國標測試, 客戶包裝確認
  29. FROM 訂單控制表 "
  30. Dim SQL字串2 As String = " ORDER BY 訂單流水號 DESC, 型體號碼, APMA確認, TVW"
  31. Private Sub Set_DGV1載入前設定()
  32. DataGridView1.DataSource = Nothing : ds.Clear()
  33. DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  34. DataGridView1.ColumnHeadersHeight = 25
  35. DataGridView1.AllowUserToAddRows = False
  36. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  37. End Sub
  38. Private Sub Set_DGV1載入後設定()
  39. cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : da.SelectCommand.CommandTimeout = 900 : da.Fill(ds) : DataGridView1.DataSource = ds.Tables(0) : conn.Close()
  40. End Sub
  41. Private Sub Set_訂單清單()
  42. Set_DGV1載入前設定()
  43. If OPEXC(0) = True Then
  44. SQL1 = SQL字串1 & 列印用SQL & " WHERE ((CXL = 0) OR (CXL IS NULL)) AND (訂單數量 - 出貨數量 <> 0) AND (CFMSPEC LIKE 'LANDED BRANDED')" & SQL字串2
  45. ElseIf OPEXC(1) = True Then
  46. SQL1 = SQL字串1 & 列印用SQL & "WHERE ((CXL = 0) OR (CXL IS NULL)) AND (訂單數量 - 出貨數量 <> 0) AND (CFMSPEC LIKE 'FIRST COST')" & SQL字串2
  47. ElseIf OPEXC(2) = True Then
  48. SQL1 = SQL字串1 & 列印用SQL & " WHERE ((CXL = 0) OR (CXL IS NULL)) AND (訂單數量 - 出貨數量 = 0) AND (CFMSPEC LIKE 'LANDED BRANDED')" & SQL字串2
  49. ElseIf OPEXC(3) = True Then
  50. SQL1 = SQL字串1 & 列印用SQL & " WHERE ((CXL = 0) OR (CXL IS NULL)) AND (訂單數量 - 出貨數量 = 0) AND (CFMSPEC LIKE 'FIRST COST')" & SQL字串2
  51. ElseIf OPEXC(4) = True Then
  52. SQL1 = SQL字串1 & 列印用SQL & " WHERE (CXL = 1) AND (CFMSPEC LIKE 'LANDED BRANDED')" & SQL字串2
  53. ElseIf OPEXC(5) = True Then
  54. SQL1 = SQL字串1 & 列印用SQL & " WHERE (CXL = 1) AND (CFMSPEC LIKE 'FIRST COST')" & SQL字串2
  55. End If
  56. Set_DGV1載入後設定()
  57. End Sub
  58. Private Sub Set_循環列印()
  59. Dim W As Integer = 2
  60. If CheckBox1.Checked = True Then : xlSheet.Cells(3, W) = "巨益 PO#" : Q = W : W = W + 1 : End If
  61. If CheckBox2.Checked = True Then : xlSheet.Cells(3, W) = "SEASON" : Q = W : W = W + 1 : End If
  62. If CheckBox3.Checked = True Then : xlSheet.Cells(3, W) = "CUST PO#" : Q = W : W = W + 1 : End If
  63. If CheckBox4.Checked = True Then : xlSheet.Cells(3, W) = "STYLE#" : Q = W : W = W + 1 : End If
  64. If CheckBox5.Checked = True Then : xlSheet.Cells(3, W) = "STYLE NAME" : Q = W : W = W + 1 : End If
  65. If CheckBox6.Checked = True Then : xlSheet.Cells(3, W) = "COLOR" : Q = W : W = W + 1 : End If
  66. If CheckBox7.Checked = True Then : xlSheet.Cells(3, W) = "DM" : Q = W : W = W + 1 : End If
  67. If CheckBox8.Checked = True Then : xlSheet.Cells(3, W) = "PRS" : Q = W : W = W + 1 : End If
  68. If CheckBox9.Checked = True Then : xlSheet.Cells(3, W) = "FTY X/F" : Q = W : W = W + 1 : End If
  69. If CheckBox10.Checked = True Then : xlSheet.Cells(3, W) = "CUST START XF" : Q = W : W = W + 1 : End If
  70. If CheckBox11.Checked = True Then : xlSheet.Cells(3, W) = "CUST CXL XF" : Q = W : W = W + 1 : End If
  71. If CheckBox12.Checked = True Then : xlSheet.Cells(3, W) = "PRICE" : Q = W : W = W + 1 : End If
  72. If CheckBox13.Checked = True Then : xlSheet.Cells(3, W) = "AMOUNT" : Q = W : W = W + 1 : End If
  73. If CheckBox14.Checked = True Then : xlSheet.Cells(3, W) = "REMARK" : Q = W : W = W + 1 : End If
  74. If CheckBox15.Checked = True Then : xlSheet.Cells(3, W) = "FTY" : Q = W : W = W + 1 : End If
  75. If CheckBox16.Checked = True Then : xlSheet.Cells(3, W) = "DIV" : Q = W : W = W + 1 : End If
  76. If CheckBox17.Checked = True Then : xlSheet.Cells(3, W) = "BUYER" : Q = W : W = W + 1 : End If
  77. If CheckBox18.Checked = True Then : xlSheet.Cells(3, W) = "材質" : Q = W : W = W + 1 : End If
  78. If CheckBox19.Checked = True Then : xlSheet.Cells(3, W) = "東莞業務備註" : Q = W : W = W + 1 : End If
  79. If CheckBox20.Checked = True Then : xlSheet.Cells(3, W) = "Pattern trial full size" : Q = W : W = W + 1 : End If
  80. If CheckBox21.Checked = True Then : xlSheet.Cells(3, W) = "Cutting dies full size" : Q = W : W = W + 1 : End If
  81. If CheckBox22.Checked = True Then : xlSheet.Cells(3, W) = "面料" : Q = W : W = W + 1 : End If
  82. If CheckBox23.Checked = True Then : xlSheet.Cells(3, W) = "副料" : Q = W : W = W + 1 : End If
  83. If CheckBox24.Checked = True Then : xlSheet.Cells(3, W) = "中底" : Q = W : W = W + 1 : End If
  84. If CheckBox25.Checked = True Then : xlSheet.Cells(3, W) = "鞋墊" : Q = W : W = W + 1 : End If
  85. If CheckBox26.Checked = True Then : xlSheet.Cells(3, W) = "大底" : Q = W : W = W + 1 : End If
  86. If CheckBox27.Checked = True Then : xlSheet.Cells(3, W) = "跟" : Q = W : W = W + 1 : End If
  87. If CheckBox28.Checked = True Then : xlSheet.Cells(3, W) = "包裝" : Q = W : W = W + 1 : End If
  88. If CheckBox29.Checked = True Then : xlSheet.Cells(3, W) = "cutting" : Q = W : W = W + 1 : End If
  89. If CheckBox30.Checked = True Then : xlSheet.Cells(3, W) = "stitching" : Q = W : W = W + 1 : End If
  90. If CheckBox31.Checked = True Then : xlSheet.Cells(3, W) = "lasting" : Q = W : W = W + 1 : End If
  91. If CheckBox32.Checked = True Then : xlSheet.Cells(3, W) = "inspection" : Q = W : W = W + 1 : End If
  92. If CheckBox33.Checked = True Then : xlSheet.Cells(3, W) = "result" : Q = W : W = W + 1 : End If
  93. If CheckBox34.Checked = True Then : xlSheet.Cells(3, W) = "工廠備註" : Q = W : W = W + 1 : End If
  94. If CheckBox35.Checked = True Then : xlSheet.Cells(3, W) = "資料流水號" : Q = W : W = W + 1 : End If
  95. If CheckBox36.Checked = True Then : xlSheet.Cells(3, W) = "實際離廠日" : Q = W : W = W + 1 : End If
  96. If CheckBox37.Checked = True Then : xlSheet.Cells(3, W) = "出貨數量" : Q = W : W = W + 1 : End If
  97. If CheckBox38.Checked = True Then : xlSheet.Cells(3, W) = "CXLTime" : Q = W : W = W + 1 : End If
  98. If CheckBox39.Checked = True Then : xlSheet.Cells(3, W) = "驗貨報告圖片" : Q = W : W = W + 1 : End If
  99. Set_訂單清單()
  100. For i As Integer = 0 To DataGridView1.Rows.Count - 1
  101. W = 2
  102. If CheckBox1.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("訂單流水號").Value : W = W + 1 : End If
  103. If CheckBox2.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("年份季度").Value : W = W + 1 : End If
  104. If CheckBox3.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("客戶訂單號").Value : W = W + 1 : End If
  105. If CheckBox4.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("型體號碼").Value : W = W + 1 : End If
  106. If CheckBox5.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("型體名稱").Value : W = W + 1 : End If
  107. If CheckBox6.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("顏色").Value : W = W + 1 : End If
  108. If CheckBox7.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("楦型").Value : W = W + 1 : End If
  109. If CheckBox8.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("訂單數量").Value : P = W : W = W + 1 : End If
  110. If CheckBox9.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("工廠交期").Value : G = W : W = W + 1 : End If
  111. If CheckBox10.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("交期開始").Value : H = W : W = W + 1 : End If
  112. If CheckBox11.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("交期結束").Value : J = W : W = W + 1 : End If
  113. If CheckBox12.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("單價").Value : R = W : W = W + 1 : End If
  114. If CheckBox13.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("總金額").Value : A = W : W = W + 1 : End If
  115. If CheckBox14.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("備註").Value : W = W + 1 : End If
  116. If CheckBox15.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("生產工廠").Value : W = W + 1 : End If
  117. If CheckBox16.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("訂單種類").Value : W = W + 1 : End If
  118. If CheckBox17.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("BUYER").Value : W = W + 1 : End If
  119. If CheckBox18.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("材質").Value : W = W + 1 : End If
  120. If CheckBox19.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("東莞業務備註").Value : W = W + 1 : End If
  121. If CheckBox20.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("手剪全套").Value : W = W + 1 : End If
  122. If CheckBox21.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("斬刀全套").Value : W = W + 1 : End If
  123. If CheckBox22.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("面料").Value : W = W + 1 : End If
  124. If CheckBox23.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("副料").Value : W = W + 1 : End If
  125. If CheckBox24.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("中底").Value : W = W + 1 : End If
  126. If CheckBox25.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("鞋墊").Value : W = W + 1 : End If
  127. If CheckBox26.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("大底").Value : W = W + 1 : End If
  128. If CheckBox27.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("跟").Value : W = W + 1 : End If
  129. If CheckBox28.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("包裝").Value : W = W + 1 : End If
  130. If CheckBox29.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("裁斷時間").Value : W = W + 1 : End If
  131. If CheckBox30.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("針車時間").Value : W = W + 1 : End If
  132. If CheckBox31.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("成型時間").Value : W = W + 1 : End If
  133. If CheckBox32.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("驗貨時間").Value : W = W + 1 : End If
  134. If CheckBox33.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("驗貨結果").Value : W = W + 1 : End If
  135. If CheckBox34.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("工廠備註").Value : W = W + 1 : End If
  136. If CheckBox35.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("資料流水號").Value : W = W + 1 : End If
  137. If CheckBox36.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("實際離廠日").Value : W = W + 1 : End If
  138. If CheckBox37.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("出貨數量").Value : W = W + 1 : End If
  139. If CheckBox38.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("CXLTime").Value : W = W + 1 : End If
  140. If CheckBox39.Checked = True Then : xlSheet.Cells(i + 4, W) = DataGridView1.Rows(i).Cells("驗貨報告圖片").Value : W = W + 1 : End If
  141. With xlApp.Selection
  142. .Font.Bold = True
  143. End With
  144. Next i
  145. BB(xlApp, xlSheet)
  146. End Sub
  147. Private Sub 列印_量產訂單控制表_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  148. FormBorderStyle = FormBorderStyle.SizableToolWindow
  149. DataGridView1.Visible = False : CheckBox40.Checked = True : CheckBox45.Checked = False : CheckBox46.Checked = False
  150. If gUserName = "李協叡" Then
  151. CheckBox12.Visible = True : CheckBox13.Visible = True
  152. Else
  153. CheckBox12.Visible = False : CheckBox13.Visible = False
  154. End If
  155. End Sub
  156. Private Sub 列印1()
  157. xlSheet = NewMethod(xlBook) : xlApp.Sheets(1).Name = "LANDED BRANDED" : xlBook.Activate() : xlSheet.Activate()
  158. OPEXC(0) = True : OPEXC(1) = False : OPEXC(2) = False : OPEXC(3) = False : OPEXC(4) = False : OPEXC(5) = False
  159. xlSheet.Range("A1").Select() : xlSheet.Cells(2, 2) = "Production Schedule - LANDED BRANDED" : Set_循環列印()
  160. End Sub
  161. Private Sub 列印2()
  162. xlSheet = NewMethod(xlBook) : xlApp.Sheets(1).Name = "FIRST COST" : xlBook.Activate() : xlSheet.Activate()
  163. OPEXC(0) = False : OPEXC(1) = True : OPEXC(2) = False : OPEXC(3) = False : OPEXC(4) = False : OPEXC(5) = False
  164. xlSheet.Range("A1").Select() : xlSheet.Cells(2, 2) = "Production Schedule - FIRST COST" : Set_循環列印()
  165. End Sub
  166. Private Sub 列印3()
  167. xlSheet = NewMethod(xlBook) : xlApp.Sheets(1).Name = "LANDED BRANDED(Shipped)" : xlBook.Activate() : xlSheet.Activate()
  168. OPEXC(0) = False : OPEXC(1) = False : OPEXC(2) = True : OPEXC(3) = False : OPEXC(4) = False : OPEXC(5) = False
  169. xlSheet.Range("A1").Select() : xlSheet.Cells(2, 2) = "Production Schedule - LANDED BRANDED(Shipped)" : Set_循環列印()
  170. End Sub
  171. Private Sub 列印4()
  172. xlSheet = NewMethod(xlBook) : xlApp.Sheets(1).Name = "FIRST COST(Shipped)" : xlBook.Activate() : xlSheet.Activate()
  173. OPEXC(0) = False : OPEXC(1) = False : OPEXC(2) = False : OPEXC(3) = True : OPEXC(4) = False : OPEXC(5) = False
  174. xlSheet.Range("A1").Select() : xlSheet.Cells(2, 2) = "Production Schedule - FIRST COST(Shipped)" : Set_循環列印()
  175. End Sub
  176. Private Sub 列印5()
  177. xlSheet = NewMethod(xlBook) : xlApp.Sheets(1).Name = "LANDED BRANDED(CXL)" : xlBook.Activate() : xlSheet.Activate()
  178. OPEXC(0) = False : OPEXC(1) = False : OPEXC(2) = False : OPEXC(3) = False : OPEXC(4) = True : OPEXC(5) = False
  179. xlSheet.Range("A1").Select() : xlSheet.Cells(2, 2) = "Production Schedule - LANDED BRANDED(CXL)" : Set_循環列印()
  180. End Sub
  181. Private Sub 列印6()
  182. xlSheet = NewMethod(xlBook) : xlApp.Sheets(1).Name = "FIRST COST(CXL)" : xlBook.Activate() : xlSheet.Activate()
  183. OPEXC(0) = False : OPEXC(1) = False : OPEXC(2) = False : OPEXC(3) = False : OPEXC(4) = False : OPEXC(5) = True
  184. xlSheet.Range("A1").Select() : xlSheet.Cells(2, 2) = "Production Schedule - FIRST COST(CXL)" : Set_循環列印()
  185. End Sub
  186. Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
  187. xlApp = CType(CreateObject("Excel.Application"), Microsoft.Office.Interop.Excel.Application)
  188. xlApp.Visible = True
  189. xlApp.DisplayAlerts = True
  190. xlApp.Application.WindowState = xlMaximized
  191. xlBook = xlApp.Workbooks.Add
  192. If CheckBox40.Checked = True And CheckBox45.Checked = False And CheckBox46.Checked = False Then
  193. 列印2() : 列印1()
  194. ElseIf CheckBox40.Checked = False And CheckBox45.Checked = True And CheckBox46.Checked = False Then
  195. 列印4() : 列印3() : 列印2() : 列印1()
  196. ElseIf CheckBox40.Checked = False And CheckBox45.Checked = False And CheckBox46.Checked = True Then
  197. 列印6() : 列印5() : 列印4() : 列印3() : 列印2() : 列印1()
  198. End If
  199. xlSheet.PageSetup.PrintArea = ""
  200. xlApp.Cells.Select()
  201. xlApp.Application.WindowState = xlMinimized
  202. MsgBox("列印完成")
  203. Me.Close()
  204. End Sub
  205. Private Shared Function NewMethod(xlBook As Microsoft.Office.Interop.Excel.Workbook) As Microsoft.Office.Interop.Excel.Worksheet
  206. Return CType(xlBook.Worksheets.Add, Microsoft.Office.Interop.Excel.Worksheet)
  207. End Function
  208. Private Sub BB(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  209. Dim 位置41 As String
  210. If CheckBox8.Checked = True Then
  211. If P = 0 Then
  212. Else
  213. If P = 2 Then : 位置1 = "B" : ElseIf P = 3 Then : 位置1 = "C" : ElseIf P = 4 Then : 位置1 = "D" : ElseIf P = 5 Then : 位置1 = "E" : ElseIf P = 6 Then : 位置1 = "F"
  214. ElseIf P = 7 Then : 位置1 = "G" : ElseIf P = 8 Then : 位置1 = "H" : ElseIf P = 9 Then : 位置1 = "I" : ElseIf P = 10 Then : 位置1 = "J" : ElseIf P = 11 Then : 位置1 = "K"
  215. ElseIf P = 12 Then : 位置1 = "L" : ElseIf P = 13 Then : 位置1 = "M" : ElseIf P = 14 Then : 位置1 = "N" : ElseIf P = 15 Then : 位置1 = "O" : ElseIf P = 16 Then : 位置1 = "P"
  216. ElseIf P = 17 Then : 位置1 = "Q" : ElseIf P = 18 Then : 位置1 = "R" : ElseIf P = 19 Then : 位置1 = "S" : ElseIf P = 20 Then : 位置1 = "T" : ElseIf P = 21 Then : 位置1 = "U"
  217. ElseIf P = 22 Then : 位置1 = "V" : ElseIf P = 23 Then : 位置1 = "W" : ElseIf P = 24 Then : 位置1 = "X" : ElseIf P = 25 Then : 位置1 = "Y" : ElseIf P = 26 Then : 位置1 = "Z"
  218. ElseIf P = 27 Then : 位置1 = "AA" : ElseIf P = 28 Then : 位置1 = "AB" : ElseIf P = 29 Then : 位置1 = "AC" : ElseIf P = 30 Then : 位置1 = "AD" : ElseIf P = 31 Then : 位置1 = "AE"
  219. ElseIf P = 32 Then : 位置1 = "AF" : ElseIf P = 33 Then : 位置1 = "AG" : ElseIf P = 34 Then : 位置1 = "AH" : ElseIf P = 35 Then : 位置1 = "AI" : ElseIf P = 36 Then : 位置1 = "AJ"
  220. ElseIf P = 37 Then : 位置1 = "AK" : ElseIf P = 38 Then : 位置1 = "AL" : ElseIf P = 39 Then : 位置1 = "AM" : ElseIf P = 40 Then : 位置1 = "AN" : ElseIf P = 41 Then : 位置1 = "AO"
  221. ElseIf P = 42 Then : 位置1 = "AP" : ElseIf P = 43 Then : 位置1 = "AQ" : ElseIf P = 44 Then : 位置1 = "AR" : ElseIf P = 45 Then : 位置1 = "AS" : ElseIf P = 46 Then : 位置1 = "AT"
  222. ElseIf P = 47 Then : 位置1 = "AU"
  223. End If
  224. 位置1 = 位置1 & "3" & ":" & 位置1 & "10000"
  225. xlSheet.Range(位置1).Select()
  226. myExcel.Selection.NumberFormatLocal = "#,##0"
  227. End If
  228. End If
  229. If CheckBox9.Checked = True Then
  230. If G = 0 Then
  231. Else
  232. If G = 2 Then : 位置5 = "B" : ElseIf G = 3 Then : 位置5 = "C" : ElseIf G = 4 Then : 位置5 = "D" : ElseIf G = 5 Then : 位置5 = "E" : ElseIf G = 6 Then : 位置5 = "F"
  233. ElseIf G = 7 Then : 位置5 = "G" : ElseIf G = 8 Then : 位置5 = "H" : ElseIf G = 9 Then : 位置5 = "I" : ElseIf G = 10 Then : 位置5 = "J" : ElseIf G = 11 Then : 位置5 = "K"
  234. ElseIf G = 12 Then : 位置5 = "L" : ElseIf G = 13 Then : 位置5 = "M" : ElseIf G = 14 Then : 位置5 = "N" : ElseIf G = 15 Then : 位置5 = "O" : ElseIf G = 16 Then : 位置5 = "G"
  235. ElseIf G = 17 Then : 位置5 = "Q" : ElseIf G = 18 Then : 位置5 = "R" : ElseIf G = 19 Then : 位置5 = "S" : ElseIf G = 20 Then : 位置5 = "T" : ElseIf G = 21 Then : 位置5 = "U"
  236. ElseIf G = 22 Then : 位置5 = "V" : ElseIf G = 23 Then : 位置5 = "W" : ElseIf G = 24 Then : 位置5 = "X" : ElseIf G = 25 Then : 位置5 = "Y" : ElseIf G = 26 Then : 位置5 = "Z"
  237. ElseIf G = 27 Then : 位置5 = "AA" : ElseIf G = 28 Then : 位置5 = "AB" : ElseIf G = 29 Then : 位置5 = "AC" : ElseIf G = 30 Then : 位置5 = "AD" : ElseIf G = 31 Then : 位置5 = "AE"
  238. ElseIf G = 32 Then : 位置5 = "AF" : ElseIf G = 33 Then : 位置5 = "AG" : ElseIf G = 34 Then : 位置5 = "AH" : ElseIf G = 35 Then : 位置5 = "AI" : ElseIf G = 36 Then : 位置5 = "AJ"
  239. ElseIf G = 37 Then : 位置5 = "AK" : ElseIf G = 38 Then : 位置5 = "AL" : ElseIf G = 39 Then : 位置5 = "AM" : ElseIf G = 40 Then : 位置5 = "AN" : ElseIf G = 41 Then : 位置5 = "AO"
  240. ElseIf G = 42 Then : 位置5 = "AG" : ElseIf G = 43 Then : 位置5 = "AQ" : ElseIf G = 44 Then : 位置5 = "AR" : ElseIf G = 45 Then : 位置5 = "AS" : ElseIf G = 46 Then : 位置5 = "AT"
  241. ElseIf G = 47 Then : 位置5 = "AU"
  242. End If
  243. 位置5 = 位置5 & "3" & ":" & 位置5 & "10000"
  244. xlSheet.Range(位置5).Select()
  245. myExcel.Selection.NumberFormatLocal = "yyy/mm/dd"
  246. End If
  247. End If
  248. If CheckBox10.Checked = True Then
  249. If H = 0 Then
  250. Else
  251. If H = 2 Then : 位置6 = "B" : ElseIf H = 3 Then : 位置6 = "C" : ElseIf H = 4 Then : 位置6 = "D" : ElseIf H = 5 Then : 位置6 = "E" : ElseIf H = 6 Then : 位置6 = "F"
  252. ElseIf H = 7 Then : 位置6 = "G" : ElseIf H = 8 Then : 位置6 = "H" : ElseIf H = 9 Then : 位置6 = "I" : ElseIf H = 10 Then : 位置6 = "J" : ElseIf H = 11 Then : 位置6 = "K"
  253. ElseIf H = 12 Then : 位置6 = "L" : ElseIf H = 13 Then : 位置6 = "M" : ElseIf H = 14 Then : 位置6 = "N" : ElseIf H = 15 Then : 位置6 = "O" : ElseIf H = 16 Then : 位置6 = "P"
  254. ElseIf H = 17 Then : 位置6 = "Q" : ElseIf H = 18 Then : 位置6 = "R" : ElseIf H = 19 Then : 位置6 = "S" : ElseIf H = 20 Then : 位置6 = "T" : ElseIf H = 21 Then : 位置6 = "U"
  255. ElseIf H = 22 Then : 位置6 = "V" : ElseIf H = 23 Then : 位置6 = "W" : ElseIf H = 24 Then : 位置6 = "X" : ElseIf H = 25 Then : 位置6 = "Y" : ElseIf H = 26 Then : 位置6 = "Z"
  256. ElseIf H = 27 Then : 位置6 = "AA" : ElseIf H = 28 Then : 位置6 = "AB" : ElseIf H = 29 Then : 位置6 = "AC" : ElseIf H = 30 Then : 位置6 = "AD" : ElseIf H = 31 Then : 位置6 = "AE"
  257. ElseIf H = 32 Then : 位置6 = "AF" : ElseIf H = 33 Then : 位置6 = "AG" : ElseIf H = 34 Then : 位置6 = "AH" : ElseIf H = 35 Then : 位置6 = "AI" : ElseIf H = 36 Then : 位置6 = "AJ"
  258. ElseIf H = 37 Then : 位置6 = "AK" : ElseIf H = 38 Then : 位置6 = "AL" : ElseIf H = 39 Then : 位置6 = "AM" : ElseIf H = 40 Then : 位置6 = "AN" : ElseIf H = 41 Then : 位置6 = "AO"
  259. ElseIf H = 42 Then : 位置6 = "AP" : ElseIf H = 43 Then : 位置6 = "AQ" : ElseIf H = 44 Then : 位置6 = "AR" : ElseIf H = 45 Then : 位置6 = "AS" : ElseIf H = 46 Then : 位置6 = "AT"
  260. ElseIf H = 47 Then : 位置6 = "AU"
  261. End If
  262. 位置6 = 位置6 & "3" & ":" & 位置6 & "10000"
  263. xlSheet.Range(位置6).Select()
  264. myExcel.Selection.NumberFormatLocal = "yyy/mm/dd"
  265. End If
  266. End If
  267. If CheckBox11.Checked = True Then
  268. If J = 0 Then
  269. Else
  270. If J = 2 Then : 位置7 = "B" : ElseIf J = 3 Then : 位置7 = "C" : ElseIf J = 4 Then : 位置7 = "D" : ElseIf J = 5 Then : 位置7 = "E" : ElseIf J = 6 Then : 位置7 = "F"
  271. ElseIf J = 7 Then : 位置7 = "G" : ElseIf J = 8 Then : 位置7 = "H" : ElseIf J = 9 Then : 位置7 = "I" : ElseIf J = 10 Then : 位置7 = "J" : ElseIf J = 11 Then : 位置7 = "K"
  272. ElseIf J = 12 Then : 位置7 = "L" : ElseIf J = 13 Then : 位置7 = "M" : ElseIf J = 14 Then : 位置7 = "N" : ElseIf J = 15 Then : 位置7 = "O" : ElseIf J = 16 Then : 位置7 = "P"
  273. ElseIf J = 17 Then : 位置7 = "Q" : ElseIf J = 18 Then : 位置7 = "R" : ElseIf J = 19 Then : 位置7 = "S" : ElseIf J = 20 Then : 位置7 = "T" : ElseIf J = 21 Then : 位置7 = "U"
  274. ElseIf J = 22 Then : 位置7 = "V" : ElseIf J = 23 Then : 位置7 = "W" : ElseIf J = 24 Then : 位置7 = "X" : ElseIf J = 25 Then : 位置7 = "Y" : ElseIf J = 26 Then : 位置7 = "Z"
  275. ElseIf J = 27 Then : 位置7 = "AA" : ElseIf J = 28 Then : 位置7 = "AB" : ElseIf J = 29 Then : 位置7 = "AC" : ElseIf J = 30 Then : 位置7 = "AD" : ElseIf J = 31 Then : 位置7 = "AE"
  276. ElseIf J = 32 Then : 位置7 = "AF" : ElseIf J = 33 Then : 位置7 = "AG" : ElseIf J = 34 Then : 位置7 = "AH" : ElseIf J = 35 Then : 位置7 = "AI" : ElseIf J = 36 Then : 位置7 = "AJ"
  277. ElseIf J = 37 Then : 位置7 = "AK" : ElseIf J = 38 Then : 位置7 = "AL" : ElseIf J = 39 Then : 位置7 = "AM" : ElseIf J = 40 Then : 位置7 = "AN" : ElseIf J = 41 Then : 位置7 = "AO"
  278. ElseIf J = 42 Then : 位置7 = "AP" : ElseIf J = 43 Then : 位置7 = "AQ" : ElseIf J = 44 Then : 位置7 = "AR" : ElseIf J = 45 Then : 位置7 = "AS" : ElseIf J = 46 Then : 位置7 = "AT"
  279. ElseIf J = 47 Then : 位置7 = "AU"
  280. End If
  281. 位置7 = 位置7 & "3" & ":" & 位置7 & "10000"
  282. xlSheet.Range(位置7).Select()
  283. myExcel.Selection.NumberFormatLocal = "yyy/mm/dd"
  284. End If
  285. End If
  286. If CheckBox12.Checked = True Then
  287. If R = 2 Then : 位置2 = "B" : ElseIf R = 3 Then : 位置2 = "C" : ElseIf R = 4 Then : 位置2 = "D" : ElseIf R = 5 Then : 位置2 = "E" : ElseIf R = 6 Then : 位置2 = "F"
  288. ElseIf R = 7 Then : 位置2 = "G" : ElseIf R = 8 Then : 位置2 = "H" : ElseIf R = 9 Then : 位置2 = "I" : ElseIf R = 10 Then : 位置2 = "J" : ElseIf R = 11 Then : 位置2 = "K"
  289. ElseIf R = 12 Then : 位置2 = "L" : ElseIf R = 13 Then : 位置2 = "M" : ElseIf R = 14 Then : 位置2 = "N" : ElseIf R = 15 Then : 位置2 = "O" : ElseIf R = 16 Then : 位置2 = "P"
  290. ElseIf R = 17 Then : 位置2 = "Q" : ElseIf R = 18 Then : 位置2 = "R" : ElseIf R = 19 Then : 位置2 = "S" : ElseIf R = 20 Then : 位置2 = "T" : ElseIf R = 21 Then : 位置2 = "U"
  291. ElseIf R = 22 Then : 位置2 = "V" : ElseIf R = 23 Then : 位置2 = "W" : ElseIf R = 24 Then : 位置2 = "X" : ElseIf R = 25 Then : 位置2 = "Y" : ElseIf R = 26 Then : 位置2 = "Z"
  292. ElseIf R = 27 Then : 位置2 = "AA" : ElseIf R = 28 Then : 位置2 = "AB" : ElseIf R = 29 Then : 位置2 = "AC" : ElseIf R = 30 Then : 位置2 = "AD" : ElseIf R = 31 Then : 位置2 = "AE"
  293. ElseIf R = 32 Then : 位置2 = "AF" : ElseIf R = 33 Then : 位置2 = "AG" : ElseIf R = 34 Then : 位置2 = "AH" : ElseIf R = 35 Then : 位置2 = "AI" : ElseIf R = 36 Then : 位置2 = "AJ"
  294. ElseIf R = 37 Then : 位置2 = "AK" : ElseIf R = 38 Then : 位置2 = "AL" : ElseIf R = 39 Then : 位置2 = "AM" : ElseIf R = 40 Then : 位置2 = "AN" : ElseIf R = 41 Then : 位置2 = "AO"
  295. ElseIf R = 42 Then : 位置2 = "AP" : ElseIf R = 43 Then : 位置2 = "AQ" : ElseIf R = 44 Then : 位置2 = "AR" : ElseIf R = 45 Then : 位置2 = "AS" : ElseIf R = 46 Then : 位置2 = "AT"
  296. ElseIf R = 47 Then : 位置2 = "AU"
  297. End If
  298. 位置2 = 位置2 & "3" & ":" & 位置2 & "10000"
  299. xlSheet.Range(位置2).Select()
  300. myExcel.Selection.NumberFormatLocal = "#,##0.00"
  301. End If
  302. If CheckBox13.Checked = True Then
  303. If A = 2 Then : 位置3 = "B" : ElseIf A = 3 Then : 位置3 = "C" : ElseIf A = 4 Then : 位置3 = "D" : ElseIf A = 5 Then : 位置3 = "E" : ElseIf A = 6 Then : 位置3 = "F"
  304. ElseIf A = 7 Then : 位置3 = "G" : ElseIf A = 8 Then : 位置3 = "H" : ElseIf A = 9 Then : 位置3 = "I" : ElseIf A = 10 Then : 位置3 = "J" : ElseIf A = 11 Then : 位置3 = "K"
  305. ElseIf A = 12 Then : 位置3 = "L" : ElseIf A = 13 Then : 位置3 = "M" : ElseIf A = 14 Then : 位置3 = "N" : ElseIf A = 15 Then : 位置3 = "O" : ElseIf A = 16 Then : 位置3 = "P"
  306. ElseIf A = 17 Then : 位置3 = "Q" : ElseIf A = 18 Then : 位置3 = "R" : ElseIf A = 19 Then : 位置3 = "S" : ElseIf A = 20 Then : 位置3 = "T" : ElseIf A = 21 Then : 位置3 = "U"
  307. ElseIf A = 22 Then : 位置3 = "V" : ElseIf A = 23 Then : 位置3 = "W" : ElseIf A = 24 Then : 位置3 = "X" : ElseIf A = 25 Then : 位置3 = "Y" : ElseIf A = 26 Then : 位置3 = "Z"
  308. ElseIf A = 27 Then : 位置3 = "AA" : ElseIf A = 28 Then : 位置3 = "AB" : ElseIf A = 29 Then : 位置3 = "AC" : ElseIf A = 30 Then : 位置3 = "AD" : ElseIf A = 31 Then : 位置3 = "AE"
  309. ElseIf A = 32 Then : 位置3 = "AF" : ElseIf A = 33 Then : 位置3 = "AG" : ElseIf A = 34 Then : 位置3 = "AH" : ElseIf A = 35 Then : 位置3 = "AI" : ElseIf A = 36 Then : 位置3 = "AJ"
  310. ElseIf A = 37 Then : 位置3 = "AK" : ElseIf A = 38 Then : 位置3 = "AL" : ElseIf A = 39 Then : 位置3 = "AM" : ElseIf A = 40 Then : 位置3 = "AN" : ElseIf A = 41 Then : 位置3 = "AO"
  311. ElseIf A = 42 Then : 位置3 = "AP" : ElseIf A = 43 Then : 位置3 = "AQ" : ElseIf A = 44 Then : 位置3 = "AR" : ElseIf A = 45 Then : 位置3 = "AS" : ElseIf A = 46 Then : 位置3 = "AT"
  312. ElseIf A = 47 Then : 位置3 = "AU"
  313. End If
  314. 位置3 = 位置3 & "3" & ":" & 位置3 & "10000"
  315. xlSheet.Range(位置3).Select()
  316. myExcel.Selection.NumberFormatLocal = "#,##0.00"
  317. End If
  318. If Q = 2 Then : 位置4 = "B" : ElseIf Q = 3 Then : 位置4 = "C" : ElseIf Q = 4 Then : 位置4 = "D" : ElseIf Q = 5 Then : 位置4 = "E" : ElseIf Q = 6 Then : 位置4 = "F"
  319. ElseIf Q = 7 Then : 位置4 = "G" : ElseIf Q = 8 Then : 位置4 = "H" : ElseIf Q = 9 Then : 位置4 = "I" : ElseIf Q = 10 Then : 位置4 = "J" : ElseIf Q = 11 Then : 位置4 = "K"
  320. ElseIf Q = 12 Then : 位置4 = "L" : ElseIf Q = 13 Then : 位置4 = "M" : ElseIf Q = 14 Then : 位置4 = "N" : ElseIf Q = 15 Then : 位置4 = "O" : ElseIf Q = 16 Then : 位置4 = "P"
  321. ElseIf Q = 17 Then : 位置4 = "Q" : ElseIf Q = 18 Then : 位置4 = "R" : ElseIf Q = 19 Then : 位置4 = "S" : ElseIf Q = 20 Then : 位置4 = "T" : ElseIf Q = 21 Then : 位置4 = "U"
  322. ElseIf Q = 22 Then : 位置4 = "V" : ElseIf Q = 23 Then : 位置4 = "W" : ElseIf Q = 24 Then : 位置4 = "X" : ElseIf Q = 25 Then : 位置4 = "Y" : ElseIf Q = 26 Then : 位置4 = "Z"
  323. ElseIf Q = 27 Then : 位置4 = "AA" : ElseIf Q = 28 Then : 位置4 = "AB" : ElseIf Q = 29 Then : 位置4 = "AC" : ElseIf Q = 30 Then : 位置4 = "AD" : ElseIf Q = 31 Then : 位置4 = "AE"
  324. ElseIf Q = 32 Then : 位置4 = "AF" : ElseIf Q = 33 Then : 位置4 = "AG" : ElseIf Q = 34 Then : 位置4 = "AH" : ElseIf Q = 35 Then : 位置4 = "AI" : ElseIf Q = 36 Then : 位置4 = "AJ"
  325. ElseIf Q = 37 Then : 位置4 = "AK" : ElseIf Q = 38 Then : 位置4 = "AL" : ElseIf Q = 39 Then : 位置4 = "AM" : ElseIf Q = 40 Then : 位置4 = "AN" : ElseIf Q = 41 Then : 位置4 = "AO"
  326. ElseIf Q = 42 Then : 位置4 = "AP" : ElseIf Q = 43 Then : 位置4 = "AQ" : ElseIf Q = 44 Then : 位置4 = "AR" : ElseIf Q = 45 Then : 位置4 = "AS" : ElseIf Q = 46 Then : 位置4 = "AT"
  327. ElseIf Q = 47 Then : 位置4 = "AU"
  328. End If
  329. xlSheet.Columns("A:A").ColumnWidth = 1
  330. xlSheet.Range("B2:E2").Select()
  331. With myExcel.Selection
  332. .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  333. .ReadingOrder = xlContext : .MergeCells = False
  334. End With
  335. myExcel.Selection.Merge
  336. xlSheet.Cells(2, 6) = "列印日期 : " : xlSheet.Range("F2:G2").Select()
  337. With myExcel.Selection
  338. .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  339. .ReadingOrder = xlContext : .MergeCells = False
  340. End With
  341. myExcel.Selection.Merge
  342. xlSheet.Range("F2:G2").Select()
  343. With myExcel.Selection
  344. .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  345. .ReadingOrder = xlContext : .MergeCells = True
  346. End With
  347. xlSheet.Cells(2, 8) = String.Format("{0:d}", Now) : xlSheet.Range("H2:I2").Select()
  348. With myExcel.Selection
  349. .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  350. .ReadingOrder = xlContext : .MergeCells = False
  351. End With
  352. myExcel.Selection.Merge
  353. xlSheet.Range("H2:I2").Select()
  354. xlSheet.Cells.Select()
  355. With myExcel.Selection.Font
  356. .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  357. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone
  358. End With
  359. xlSheet.Range("B2:I2").Select()
  360. With myExcel.Selection.Font
  361. .Name = "微軟正黑體" : .Size = 12 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  362. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone
  363. End With
  364. 位置41 = "B:" & 位置4
  365. xlSheet.Columns(位置41).Select : xlSheet.Columns(位置41).EntireColumn.AutoFit
  366. myExcel.ActiveWindow.ScrollColumn = 4 : myExcel.ActiveWindow.ScrollColumn = 3 : myExcel.ActiveWindow.ScrollColumn = 2 : myExcel.ActiveWindow.ScrollColumn = 1
  367. xlSheet.Rows("4:4").Select
  368. myExcel.ActiveWindow.FreezePanes = True
  369. xlSheet.Rows("3:3").Select
  370. myExcel.Selection.AutoFilter
  371. myExcel.ActiveWindow.ScrollColumn = 3 : myExcel.ActiveWindow.ScrollColumn = 2 : myExcel.ActiveWindow.ScrollColumn = 1
  372. xlSheet.Rows("3:3").Select
  373. With myExcel.Selection
  374. .HorizontalAlignment = xlGeneral : .VerticalAlignment = xlTop : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  375. .ReadingOrder = xlContext : .MergeCells = False
  376. End With
  377. If 位置4 = "A" Or 位置4 = "B" Or 位置4 = "C" Or 位置4 = "D" Or 位置4 = "E" Or 位置4 = "F" Or 位置4 = "G" Or 位置4 = "H" Or 位置4 = "I" Or 位置4 = "J" Then
  378. Else
  379. 位置41 = "J2:" & 位置4 & "2"
  380. xlSheet.Range(位置41).Select()
  381. With myExcel.Selection
  382. .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  383. .ReadingOrder = xlContext : .MergeCells = False
  384. End With
  385. myExcel.Selection.Merge
  386. End If
  387. Dim M As Integer = 4
  388. For M = 4 To DataGridView1.Rows.Count + 2
  389. M = M + 1
  390. Next M
  391. If 位置4 = "A" Or 位置4 = "B" Or 位置4 = "C" Or 位置4 = "D" Or 位置4 = "E" Or 位置4 = "F" Or 位置4 = "G" Or 位置4 = "H" Or 位置4 = "I" Or 位置4 = "J" Then
  392. 位置4 = "J"
  393. 位置41 = "B2:" & 位置4 & M
  394. Else
  395. 位置41 = "B2:" & 位置4 & M
  396. End If
  397. xlSheet.Range(位置41).Select() : myExcel.Selection.RowHeight = 13.5
  398. xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 5
  399. xlSheet.Rows("2:2").Select : myExcel.Selection.RowHeight = 25
  400. xlSheet.Rows("3:3").Select : myExcel.Selection.RowHeight = 30
  401. xlSheet.Range(位置41).Select() : xlSheet.Range("J2").Activate()
  402. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  403. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  404. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  405. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  406. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  407. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  408. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  409. myExcel.ActiveWindow.ScrollRow = 981 : myExcel.ActiveWindow.ScrollRow = 967 : myExcel.ActiveWindow.ScrollRow = 940 : myExcel.ActiveWindow.ScrollRow = 845
  410. myExcel.ActiveWindow.ScrollRow = 804 : myExcel.ActiveWindow.ScrollRow = 791 : myExcel.ActiveWindow.ScrollRow = 587 : myExcel.ActiveWindow.ScrollRow = 546
  411. myExcel.ActiveWindow.ScrollRow = 533 : myExcel.ActiveWindow.ScrollRow = 519 : myExcel.ActiveWindow.ScrollRow = 343 : myExcel.ActiveWindow.ScrollRow = 316
  412. myExcel.ActiveWindow.ScrollRow = 288 : myExcel.ActiveWindow.ScrollRow = 126 : myExcel.ActiveWindow.ScrollRow = 99 : myExcel.ActiveWindow.ScrollRow = 71
  413. myExcel.ActiveWindow.ScrollRow = 4
  414. 位置41 = "B3:" & 位置4 & "3"
  415. xlSheet.Range(位置41).Select()
  416. With myExcel.Selection.Interior
  417. .Pattern = xlSolid : .PatternColorIndex = xlAutomatic : .ThemeColor = xlThemeColorAccent5 : .TintAndShade = 0.599993896298105 : .PatternTintAndShade = 0
  418. End With
  419. xlSheet.Range("M9").Select()
  420. myExcel.ActiveWindow.ScrollColumn = 4 : myExcel.ActiveWindow.ScrollColumn = 3 : myExcel.ActiveWindow.ScrollColumn = 2 : myExcel.ActiveWindow.ScrollColumn = 1
  421. myExcel.ActiveWindow.DisplayGridlines = False
  422. End Sub
  423. Private Sub CheckBox40_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox40.Click
  424. CheckBox40.Checked = True : CheckBox45.Checked = False : CheckBox46.Checked = False
  425. End Sub
  426. Private Sub CheckBox45_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox45.Click
  427. CheckBox40.Checked = False : CheckBox45.Checked = True : CheckBox46.Checked = False
  428. End Sub
  429. Private Sub CheckBox46_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox46.Click
  430. CheckBox40.Checked = False : CheckBox45.Checked = False : CheckBox46.Checked = True
  431. End Sub
  432. End Class