Sin descripción
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 68KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785
  1. Option Strict Off
  2. Imports System.Data.SqlClient
  3. Imports System.IO
  4. Imports Microsoft.Office.Interop.Excel.XlUnderlineStyle
  5. Imports Microsoft.Office.Interop.Excel.Constants
  6. Imports Microsoft.Office.Interop.Excel.XlBordersIndex
  7. Imports Microsoft.Office.Interop.Excel.XlLineStyle
  8. Imports Microsoft.Office.Interop.Excel.XlBorderWeight
  9. Imports Microsoft.Office.Interop.Excel.XlThemeFont
  10. Imports Microsoft.Office.Interop.Excel.XlThemeColor
  11. Imports Microsoft.Office.Interop.Excel.XlWindowState
  12. Public Class 列印_預告訂單
  13. Dim conn As New SqlConnection
  14. Dim da As New SqlDataAdapter
  15. Dim cmd As New SqlCommand
  16. Dim ds As New DataSet : Dim ds1 As New DataSet : Dim ds2 As New DataSet : Dim ds3 As New DataSet
  17. Dim dr As SqlDataReader
  18. Dim N1 As Integer : Dim N2 As Integer : Dim N3 As Integer : Dim N4 As Integer : Dim N5 As Integer : Dim N6 As Integer
  19. Dim N7 As Integer : Dim N8 As Integer : Dim N9 As Integer : Dim N10 As Integer : Dim N11 As Integer
  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 Q1 As Integer : Dim ww1 As Boolean : Dim ww2 As Boolean
  24. Private Sub Set_DGV1載入前設定()
  25. DataGridView1.DataSource = Nothing : ds.Clear()
  26. DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  27. DataGridView1.ColumnHeadersHeight = 25
  28. DataGridView1.AllowUserToAddRows = False
  29. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  30. End Sub
  31. Private Sub Set_DGV1載入後設定()
  32. cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : da.Fill(ds) : DataGridView1.DataSource = ds.Tables(0) : conn.Close()
  33. End Sub
  34. Private Sub Set_清單()
  35. Set_DGV1載入前設定()
  36. SQL1 = "SELECT PAO, SO, 季節, 客戶, BUYER, 工廠, 型體號碼, 型體名稱, 總數量, ETD, ISSUE_DATE, FOB, ConstructionName, PS, 制單人, 制單時間, 版次 FROM 預告訂單控制表 " &
  37. "WHERE PAO LIKE N'" & 列印用SQL & "' AND 版次 LIKE N'" & 列印用SQL2 & "' ORDER BY SO DESC, 版次 DESC"
  38. Set_DGV1載入後設定()
  39. End Sub
  40. Private Sub Set_DGV2載入前設定()
  41. DataGridView2.DataSource = Nothing : ds1.Clear()
  42. DataGridView2.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  43. DataGridView2.ColumnHeadersHeight = 25
  44. DataGridView2.AllowUserToAddRows = False
  45. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  46. End Sub
  47. Private Sub Set_DGV2載入後設定()
  48. cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : da.Fill(ds1) : DataGridView2.DataSource = ds1.Tables(0) : conn.Close()
  49. End Sub
  50. Private Sub Set_清單2()
  51. Set_DGV2載入前設定()
  52. SQL1 = "SELECT 項次, 顏色, 雙數, SPLS, BUYING, SELLING, 流水號, 版次, 備註 FROM 預告訂單清單 WHERE (PAO LIKE N'" & 列印用SQL & "' AND 版次 LIKE N'" & 列印用SQL2 & "') ORDER BY 項次"
  53. Set_DGV2載入後設定()
  54. End Sub
  55. Private Sub Set_DGV3載入前設定()
  56. DataGridView3.DataSource = Nothing : ds2.Clear()
  57. DataGridView3.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  58. DataGridView3.ColumnHeadersHeight = 25
  59. DataGridView3.AllowUserToAddRows = False
  60. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  61. End Sub
  62. Private Sub Set_DGV3載入後設定()
  63. cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : da.Fill(ds2) : DataGridView3.DataSource = ds2.Tables(0) : conn.Close()
  64. End Sub
  65. Private Sub Set_清單3()
  66. Set_DGV3載入前設定()
  67. SQL1 = "SELECT LEFT(預告訂單部件表.部件, 2) AS 部件, 部件大項分類.部件類別 FROM 預告訂單部件表 LEFT OUTER JOIN 部件大項分類 ON LEFT(預告訂單部件表.部件, 2) = LEFT(部件大項分類.部件類別, 2) " &
  68. "WHERE (預告訂單部件表.PAO LIKE N'" & 列印用SQL & "') AND (預告訂單部件表.版次 LIKE N'" & 列印用SQL2 & "') GROUP BY LEFT(預告訂單部件表.部件, 2), 部件大項分類.部件類別 ORDER BY 部件"
  69. Set_DGV3載入後設定()
  70. End Sub
  71. Private Sub Set_DGV4載入前設定()
  72. DataGridView4.DataSource = Nothing : ds3.Clear()
  73. DataGridView4.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  74. DataGridView4.ColumnHeadersHeight = 25
  75. DataGridView4.AllowUserToAddRows = False
  76. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  77. End Sub
  78. Private Sub Set_DGV4載入後設定()
  79. cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : da.Fill(ds3) : DataGridView4.DataSource = ds3.Tables(0) : conn.Close()
  80. End Sub
  81. Private Sub Set_格式設定()
  82. DataGridView1.Visible = False : DataGridView2.Visible = False : DataGridView3.Visible = False : DataGridView4.Visible = False : PictureBox1.Visible = False
  83. End Sub
  84. Private Sub 列印_預告訂單_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  85. FormBorderStyle = FormBorderStyle.SizableToolWindow : ControlBox = False
  86. CheckBox1.Checked = True : CheckBox2.Checked = False : CheckBox3.Checked = False
  87. CheckBox4.Checked = True : CheckBox5.Checked = False : CheckBox6.Checked = False
  88. Set_清單() : Set_清單2() : Set_清單3() : Set_格式設定()
  89. End Sub
  90. Private Sub 列印1()
  91. xlSheet.Cells(1, 1) = "WTL ENTERPRISE CO., LTD." : xlSheet.Cells(1, 21) = "PAO(預告訂單)" : xlSheet.Cells(2, 1) = "11F-9., No.151, Sec. 2, Hankou Rd., Situn Dist., "
  92. xlSheet.Cells(3, 1) = "Taichung City, Taiwan 40746" : xlSheet.Cells(3, 24) = "PRINT DATE :" : xlSheet.Cells(3, 29) = "=TODAY()" : xlSheet.Cells(5, 1) = "PAO # (單號)"
  93. xlSheet.Cells(6, 1) = "CUST (客戶)" : xlSheet.Cells(7, 1) = "FACTORY (工廠)" : xlSheet.Cells(8, 1) = "STYLE # (型體號)" : xlSheet.Cells(9, 1) = "STY.NAME (型體名)"
  94. xlSheet.Cells(10, 1) = "FOB (港口)" : xlSheet.Cells(11, 1) = "BUYER (買方)" : xlSheet.Cells(12, 1) = "PS (備註)"
  95. xlSheet.Cells(5, 6) = ":" : xlSheet.Cells(6, 6) = ":" : xlSheet.Cells(7, 6) = ":" : xlSheet.Cells(8, 6) = ":" : xlSheet.Cells(9, 6) = ":" : xlSheet.Cells(10, 6) = ":" : xlSheet.Cells(11, 6) = ":"
  96. xlSheet.Cells(12, 6) = ":"
  97. xlSheet.Cells(5, 14) = "EDITION (版次)" : xlSheet.Cells(6, 14) = "SEASON (季節)" : xlSheet.Cells(7, 14) = "ISSUE. DATE (制單日期)" : xlSheet.Cells(8, 14) = "ETD (預計寄出日期)"
  98. xlSheet.Cells(9, 14) = "SO#(對應樣品單號)" : xlSheet.Cells(10, 14) = "ConstructionName" : xlSheet.Cells(11, 14) = "Q'TY (總數)"
  99. xlSheet.Cells(5, 19) = ":" : xlSheet.Cells(6, 19) = ":" : xlSheet.Cells(7, 19) = ":" : xlSheet.Cells(8, 19) = ":" : xlSheet.Cells(9, 19) = ":" : xlSheet.Cells(10, 19) = ":"
  100. xlSheet.Cells(11, 19) = ":"
  101. xlSheet.Cells(5, 7) = DataGridView1.Rows(0).Cells("PAO").Value : xlSheet.Cells(6, 7) = DataGridView1.Rows(0).Cells("客戶").Value
  102. xlSheet.Cells(7, 7) = DataGridView1.Rows(0).Cells("工廠").Value : xlSheet.Cells(8, 7) = DataGridView1.Rows(0).Cells("型體號碼").Value
  103. xlSheet.Cells(9, 7) = DataGridView1.Rows(0).Cells("型體名稱").Value : xlSheet.Cells(10, 7) = DataGridView1.Rows(0).Cells("FOB").Value
  104. xlSheet.Cells(11, 7) = DataGridView1.Rows(0).Cells("BUYER").Value : xlSheet.Cells(5, 20) = DataGridView1.Rows(0).Cells("版次").Value
  105. xlSheet.Cells(6, 20) = DataGridView1.Rows(0).Cells("季節").Value : xlSheet.Cells(7, 20) = DataGridView1.Rows(0).Cells("ISSUE_DATE").Value
  106. xlSheet.Cells(8, 20) = DataGridView1.Rows(0).Cells("ETD").Value : xlSheet.Cells(9, 20) = DataGridView1.Rows(0).Cells("SO").Value
  107. xlSheet.Cells(10, 20) = "" : xlSheet.Cells(11, 20) = DataGridView1.Rows(0).Cells("總數量").Value
  108. xlSheet.Cells(12, 7) = DataGridView1.Rows(0).Cells("PS").Value
  109. AA(xlApp, xlSheet)
  110. PictureBox1.Image = Nothing : conn.Close()
  111. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  112. SQL1 = "SELECT TOP(1) 圖片 FROM 鞋型圖片資料庫 " &
  113. "WHERE 客戶 LIKE N'" & DataGridView1.Rows(0).Cells("客戶").Value & "' AND 形體號 LIKE N'" & DataGridView1.Rows(0).Cells("型體號碼").Value &
  114. "' AND 形體名 LIKE N'" & DataGridView1.Rows(0).Cells("型體名稱").Value & "' AND 類別 LIKE N'設計圖'"
  115. cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
  116. If dr.Read() Then
  117. PictureBox1.Image = Nothing : conn.Close()
  118. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  119. SQL1 = "SELECT TOP(1) 圖片 FROM 鞋型圖片資料庫 " &
  120. "WHERE 客戶 LIKE N'" & DataGridView1.Rows(0).Cells("客戶").Value & "' AND 形體號 LIKE N'" & DataGridView1.Rows(0).Cells("型體號碼").Value &
  121. "' AND 形體名 LIKE N'" & DataGridView1.Rows(0).Cells("型體名稱").Value & "' AND 類別 LIKE N'設計圖'"
  122. cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
  123. While dr.Read() = True
  124. Dim bytes As Byte() = New Byte(-1) {} : bytes = DirectCast(dr.Item("圖片"), Byte()) : Dim oStream As New MemoryStream(bytes) : PictureBox1.Image = Bitmap.FromStream(oStream)
  125. End While
  126. conn.Close() : GG(xlApp, xlSheet)
  127. Else
  128. xlSheet.Cells(5, 28) = "系統中無圖片"
  129. conn.Close()
  130. End If : PictureBox1.SizeMode = 4
  131. N1 = 0 : N2 = 0 : N4 = 0 : N5 = 0 : N6 = -1 : N7 = -1 : N8 = 0
  132. End Sub
  133. Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
  134. If CheckBox1.Checked = False And CheckBox2.Checked = False And CheckBox3.Checked = False Then
  135. MsgBox("沒有選擇顏色分配頁數")
  136. Else
  137. xlApp = CType(CreateObject("Excel.Application"), Microsoft.Office.Interop.Excel.Application)
  138. xlBook = xlApp.Workbooks.Add
  139. xlApp.DisplayAlerts = True
  140. xlApp.Visible = True
  141. xlApp.Application.WindowState = xlMaximized
  142. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  143. If CheckBox1.Checked = True Then
  144. '三色一頁
  145. If i = 0 Then
  146. xlSheet = NewMethod(xlBook)
  147. If xlApp.Sheets(1).Name = "工作表2" Then
  148. xlApp.Sheets("工作表2").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第一頁"
  149. Else
  150. xlApp.Sheets("sheet2").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第一頁"
  151. End If
  152. xlBook.Activate() : xlSheet.Activate() : 列印1() : Q1 = 0
  153. ElseIf i = 3 Then
  154. FF(xlApp, xlSheet)
  155. xlSheet = NewMethod(xlBook)
  156. If xlApp.Sheets(1).Name = "工作表3" Then
  157. xlApp.Sheets("工作表3").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第二頁"
  158. Else
  159. xlApp.Sheets("sheet3").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第二頁"
  160. End If
  161. xlBook.Activate() : xlSheet.Activate() : 列印1() : Q1 = 0
  162. ElseIf i = 6 Then
  163. FF(xlApp, xlSheet)
  164. xlSheet = NewMethod(xlBook)
  165. If xlApp.Sheets(1).Name = "工作表4" Then
  166. xlApp.Sheets("工作表4").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第三頁"
  167. Else
  168. xlApp.Sheets("sheet4").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第三頁"
  169. End If
  170. xlBook.Activate() : xlSheet.Activate() : 列印1() : Q1 = 0
  171. ElseIf i = 9 Then
  172. FF(xlApp, xlSheet)
  173. xlSheet = NewMethod(xlBook)
  174. If xlApp.Sheets(1).Name = "工作表5" Then
  175. xlApp.Sheets("工作表5").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第四頁"
  176. Else
  177. xlApp.Sheets("sheet5").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第四頁"
  178. End If
  179. xlBook.Activate() : xlSheet.Activate() : 列印1() : Q1 = 0
  180. End If
  181. ElseIf CheckBox3.Checked = True Then
  182. '四色一頁
  183. If i = 0 Then
  184. xlSheet = NewMethod(xlBook)
  185. If xlApp.Sheets(1).Name = "工作表2" Then
  186. xlApp.Sheets("工作表2").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第一頁"
  187. Else
  188. xlApp.Sheets("sheet2").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第一頁"
  189. End If
  190. xlBook.Activate() : xlSheet.Activate() : 列印1() : Q1 = 0
  191. ElseIf i = 4 Then
  192. FF(xlApp, xlSheet)
  193. xlSheet = NewMethod(xlBook)
  194. If xlApp.Sheets(1).Name = "工作表3" Then
  195. xlApp.Sheets("工作表3").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第二頁"
  196. Else
  197. xlApp.Sheets("sheet3").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第二頁"
  198. End If
  199. xlBook.Activate() : xlSheet.Activate() : 列印1() : Q1 = 0
  200. ElseIf i = 8 Then
  201. FF(xlApp, xlSheet)
  202. xlSheet = NewMethod(xlBook)
  203. If xlApp.Sheets(1).Name = "工作表4" Then
  204. xlApp.Sheets("工作表4").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第三頁"
  205. Else
  206. xlApp.Sheets("sheet4").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第三頁"
  207. End If
  208. xlBook.Activate() : xlSheet.Activate() : 列印1() : Q1 = 0
  209. End If
  210. ElseIf CheckBox2.Checked = True Then
  211. '二色一頁
  212. If i = 0 Then
  213. xlSheet = NewMethod(xlBook)
  214. If xlApp.Sheets(1).Name = "工作表2" Then
  215. xlApp.Sheets("工作表2").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第一頁"
  216. Else
  217. xlApp.Sheets("sheet2").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第一頁"
  218. End If
  219. xlBook.Activate() : xlSheet.Activate() : 列印1() : Q1 = 0
  220. ElseIf i = 2 Then
  221. FF(xlApp, xlSheet)
  222. xlSheet = NewMethod(xlBook)
  223. If xlApp.Sheets(1).Name = "工作表3" Then
  224. xlApp.Sheets("工作表3").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第二頁"
  225. Else
  226. xlApp.Sheets("sheet3").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第二頁"
  227. End If
  228. xlBook.Activate() : xlSheet.Activate() : 列印1() : Q1 = 0
  229. ElseIf i = 4 Then
  230. FF(xlApp, xlSheet)
  231. xlSheet = NewMethod(xlBook)
  232. If xlApp.Sheets(1).Name = "工作表4" Then
  233. xlApp.Sheets("工作表4").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第三頁"
  234. Else
  235. xlApp.Sheets("sheet4").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第三頁"
  236. End If
  237. xlBook.Activate() : xlSheet.Activate() : 列印1() : Q1 = 0
  238. ElseIf i = 6 Then
  239. FF(xlApp, xlSheet)
  240. xlSheet = NewMethod(xlBook)
  241. If xlApp.Sheets(1).Name = "工作表5" Then
  242. xlApp.Sheets("工作表5").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第四頁"
  243. Else
  244. xlApp.Sheets("sheet5").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第四頁"
  245. End If
  246. xlBook.Activate() : xlSheet.Activate() : 列印1() : Q1 = 0
  247. ElseIf i = 8 Then
  248. FF(xlApp, xlSheet)
  249. xlSheet = NewMethod(xlBook)
  250. If xlApp.Sheets(1).Name = "工作表6" Then
  251. xlApp.Sheets("工作表6").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第五頁"
  252. Else
  253. xlApp.Sheets("sheet6").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第五頁"
  254. End If
  255. xlBook.Activate() : xlSheet.Activate() : 列印1() : Q1 = 0
  256. ElseIf i = 10 Then
  257. FF(xlApp, xlSheet)
  258. xlSheet = NewMethod(xlBook)
  259. If xlApp.Sheets(1).Name = "工作表7" Then
  260. xlApp.Sheets("工作表7").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第六頁"
  261. Else
  262. xlApp.Sheets("sheet7").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第六頁"
  263. End If
  264. xlBook.Activate() : xlSheet.Activate() : 列印1() : Q1 = 0
  265. End If
  266. End If
  267. N6 = N6 + 1 : N7 = N7 + 1 : N9 = Q1 + N2 + N4 + N5
  268. xlSheet.Cells(Q1 + N2 + N4 + N5 + 14, 1) = "#" : xlSheet.Cells(Q1 + N2 + N4 + N5 + 14, 2) = "COLOR (顏色)" : xlSheet.Cells(Q1 + N2 + N4 + N5 + 14, 8) = "PRS (雙數)"
  269. xlSheet.Cells(Q1 + N2 + N4 + N5 + 14, 11) = "SPLS"
  270. If CheckBox4.Checked = True Then
  271. xlSheet.Cells(Q1 + N2 + N4 + N5 + 14, 14) = "BUYING" : xlSheet.Cells(Q1 + N2 + N4 + N5 + 14, 17) = "SELLING"
  272. ElseIf CheckBox5.Checked = True Then
  273. xlSheet.Cells(Q1 + N2 + N4 + N5 + 14, 14) = "BUYING"
  274. ElseIf CheckBox6.Checked = True Then
  275. xlSheet.Cells(Q1 + N2 + N4 + N5 + 14, 14) = "SELLING"
  276. End If
  277. xlSheet.Cells(Q1 + N2 + N4 + N5 + 15, 1) = DataGridView2.Rows(i).Cells("項次").Value : xlSheet.Cells(Q1 + N2 + N4 + N5 + 15, 2) = DataGridView2.Rows(i).Cells("顏色").Value
  278. xlSheet.Cells(Q1 + N2 + N4 + N5 + 15, 8) = DataGridView2.Rows(i).Cells("雙數").Value : xlSheet.Cells(Q1 + N2 + N4 + N5 + 15, 11) = DataGridView2.Rows(i).Cells("SPLS").Value
  279. If CheckBox4.Checked = True Then
  280. xlSheet.Cells(Q1 + N2 + N4 + N5 + 15, 14) = DataGridView2.Rows(i).Cells("BUYING").Value : xlSheet.Cells(Q1 + N2 + N4 + N5 + 15, 17) = DataGridView2.Rows(i).Cells("SELLING").Value
  281. ElseIf CheckBox5.Checked = True Then
  282. xlSheet.Cells(Q1 + N2 + N4 + N5 + 15, 14) = DataGridView2.Rows(i).Cells("BUYING").Value
  283. ElseIf CheckBox6.Checked = True Then
  284. xlSheet.Cells(Q1 + N2 + N4 + N5 + 15, 14) = DataGridView2.Rows(i).Cells("SELLING").Value
  285. End If
  286. xlSheet.Cells(Q1 + N2 + N4 + N5 + 16, 1) = "#" : xlSheet.Cells(Q1 + N2 + N4 + N5 + 16, 2) = "DESCRIPTION (部件說明)" : xlSheet.Cells(Q1 + N2 + N4 + N5 + 16, 8) = "MATERIALS (材料名稱)"
  287. xlSheet.Cells(Q1 + N2 + N4 + N5 + 16, 14) = "COLOR (顏色)" : xlSheet.Cells(Q1 + N2 + N4 + N5 + 16, 20) = "SUPPLIER (廠商)" : xlSheet.Cells(Q1 + N2 + N4 + N5 + 16, 24) = "REMARKS (備註)"
  288. BB(xlApp, xlSheet)
  289. PictureBox1.Image = Nothing : conn.Close()
  290. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  291. SQL1 = "SELECT TOP(1) 圖片 FROM 鞋型圖片資料庫 " &
  292. "WHERE 客戶 LIKE N'" & DataGridView1.Rows(0).Cells("客戶").Value & "' AND 形體號 LIKE N'" & DataGridView1.Rows(0).Cells("型體號碼").Value &
  293. "' AND 形體名 LIKE N'" & DataGridView1.Rows(0).Cells("型體名稱").Value & "' AND 顏色 LIKE N'" & DataGridView2.Rows(i).Cells("顏色").Value & "'"
  294. cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
  295. If dr.Read() Then
  296. PictureBox1.Image = Nothing : conn.Close()
  297. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  298. SQL1 = "SELECT TOP(1) 圖片 FROM 鞋型圖片資料庫 " &
  299. "WHERE 客戶 LIKE N'" & DataGridView1.Rows(0).Cells("客戶").Value & "' AND 形體號 LIKE N'" & DataGridView1.Rows(0).Cells("型體號碼").Value &
  300. "' AND 形體名 LIKE N'" & DataGridView1.Rows(0).Cells("型體名稱").Value & "' AND 顏色 LIKE N'" & DataGridView2.Rows(i).Cells("顏色").Value & "'"
  301. cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
  302. While dr.Read() = True
  303. Dim bytes As Byte() = New Byte(-1) {} : bytes = DirectCast(dr.Item("圖片"), Byte()) : Dim oStream As New MemoryStream(bytes) : PictureBox1.Image = Bitmap.FromStream(oStream)
  304. End While
  305. conn.Close() : HH(xlApp, xlSheet)
  306. Else
  307. xlSheet.Cells(Q1 + N2 + N4 + N5 + 14, 28) = "系統中無圖片"
  308. conn.Close()
  309. End If : PictureBox1.SizeMode = 4
  310. N3 = 0 ':
  311. For ii As Integer = 0 To DataGridView3.Rows.Count - 1
  312. xlSheet.Cells(ii + N2 + N4 + N5 + 17 + N6, 2) = DataGridView3.Rows(ii).Cells("部件類別").Value
  313. N10 = ii + N2 + N4 + N5 + N6 : CC(xlApp, xlSheet)
  314. Set_DGV4載入前設定()
  315. SQL1 = "SELECT PAO, 項次, 部件, 材料名稱, 材料說明, 備註, 廠商, 版次, 流水號 FROM 預告訂單部件表 " &
  316. "WHERE (PAO LIKE N'" & 列印用SQL & "') AND (版次 LIKE N'" & 列印用SQL2 & "') AND (流水號 LIKE N'" & DataGridView2.Rows(i).Cells("流水號").Value & "') " &
  317. "AND (部件 LIKE N'" & DataGridView3.Rows(ii).Cells("部件").Value & "%') ORDER BY 項次, 部件"
  318. Set_DGV4載入後設定()
  319. For iii As Integer = 0 To DataGridView4.Rows.Count - 1
  320. xlSheet.Cells(iii + N2 + N3 + N8 + N5 + N6 + N7 + 18, 1) = DataGridView2.Rows(i).Cells("項次").Value
  321. xlSheet.Cells(iii + N2 + N3 + N8 + N5 + N6 + N7 + 18, 2) = DataGridView4.Rows(iii).Cells("部件").Value
  322. xlSheet.Cells(iii + N2 + N3 + N8 + N5 + N6 + N7 + 18, 8) = DataGridView4.Rows(iii).Cells("材料名稱").Value
  323. xlSheet.Cells(iii + N2 + N3 + N8 + N5 + N6 + N7 + 18, 14) = DataGridView4.Rows(iii).Cells("材料說明").Value
  324. xlSheet.Cells(iii + N2 + N3 + N8 + N5 + N6 + N7 + 18, 20) = DataGridView4.Rows(iii).Cells("廠商").Value
  325. xlSheet.Cells(iii + N2 + N3 + N8 + N5 + N6 + N7 + 18, 24) = DataGridView4.Rows(iii).Cells("備註").Value
  326. If Len(DataGridView4.Rows(iii).Cells("材料名稱").Value) > 45 Then
  327. ww1 = True
  328. Else
  329. ww1 = False
  330. End If
  331. If Len(DataGridView4.Rows(iii).Cells("備註").Value) > 25 Then
  332. ww2 = True
  333. Else
  334. ww2 = False
  335. End If
  336. N1 = iii + 1 : N11 = iii + N2 + N3 + N8 + N5 + N6 + N7 : DD(xlApp, xlSheet)
  337. Next iii
  338. N2 = N2 + N1 : N3 = ii + 1
  339. Next ii
  340. N4 = N4 + N3 + 1 : N8 = N8 + N3
  341. With xlApp.Selection : .Font.Bold = True : End With
  342. N5 = N5 + 2 : EE(xlApp, xlSheet) : Q1 = Q1 + 1
  343. Next i
  344. FF(xlApp, xlSheet)
  345. xlSheet.PageSetup.PrintArea = ""
  346. xlApp.Cells.Select()
  347. xlSheet.Range("B1").Select()
  348. xlApp.Application.WindowState = xlMinimized
  349. MsgBox("列印完成")
  350. Me.Close()
  351. End If
  352. End Sub
  353. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  354. 列印用SQL = "" : Me.Close()
  355. End Sub
  356. Private Shared Function NewMethod(xlBook As Microsoft.Office.Interop.Excel.Workbook) As Microsoft.Office.Interop.Excel.Worksheet
  357. Return CType(xlBook.Worksheets.Add, Microsoft.Office.Interop.Excel.Worksheet)
  358. End Function
  359. Private Sub AA(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  360. xlSheet.Cells.Select()
  361. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  362. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  363. xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 3
  364. xlSheet.Columns("B:G").Select : myExcel.Selection.ColumnWidth = 4
  365. xlSheet.Columns("H:M").Select : myExcel.Selection.ColumnWidth = 8
  366. xlSheet.Columns("N:AH").Select : myExcel.Selection.ColumnWidth = 3
  367. xlSheet.Range("A1").Select()
  368. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 26 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  369. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  370. xlSheet.Range("U1").Select()
  371. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 22 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  372. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  373. xlSheet.Range("A2").Select()
  374. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 14 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  375. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  376. xlSheet.Range("A3").Select()
  377. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 14 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  378. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  379. xlSheet.Range("A3:AH3").Select()
  380. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  381. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  382. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  383. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  384. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  385. xlSheet.Rows("4:4").Select : myExcel.Selection.RowHeight = 3
  386. xlSheet.Range("G5:M5").Select() : myExcel.Selection.Merge
  387. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  388. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  389. xlSheet.Range("G6:M6").Select() : myExcel.Selection.Merge
  390. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  391. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  392. xlSheet.Range("G7:M7").Select() : myExcel.Selection.Merge
  393. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  394. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  395. xlSheet.Range("G8:M8").Select() : myExcel.Selection.Merge
  396. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  397. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  398. xlSheet.Range("G9:M9").Select() : myExcel.Selection.Merge
  399. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  400. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  401. xlSheet.Range("G10:M10").Select() : myExcel.Selection.Merge
  402. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  403. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  404. xlSheet.Range("G11:M11").Select() : myExcel.Selection.Merge
  405. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  406. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  407. xlSheet.Range("T5:Z5").Select() : myExcel.Selection.Merge
  408. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  409. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  410. xlSheet.Range("T6:Z6").Select() : myExcel.Selection.Merge
  411. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  412. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  413. xlSheet.Range("T7:Z7").Select() : myExcel.Selection.Merge
  414. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  415. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  416. xlSheet.Range("T8:Z8").Select() : myExcel.Selection.Merge
  417. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  418. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  419. xlSheet.Range("T9:Z9").Select() : myExcel.Selection.Merge
  420. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  421. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  422. xlSheet.Range("T10:Z10").Select() : myExcel.Selection.Merge
  423. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  424. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  425. xlSheet.Range("T11:Z11").Select() : myExcel.Selection.Merge
  426. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  427. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  428. xlSheet.Range("AA3:AC3").Select() : myExcel.Selection.Merge
  429. xlSheet.Range("AB5:AH12").Select() : myExcel.Selection.Merge
  430. xlSheet.Columns("A:A").Select : myExcel.Selection.NumberFormatLocal = "@"
  431. myExcel.ActiveWindow.DisplayGridlines = False
  432. xlSheet.Range("G12:AA12").Select() : myExcel.Selection.Merge
  433. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  434. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  435. xlSheet.Range("A12:AH12").Select()
  436. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  437. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  438. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  439. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  440. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  441. End Sub
  442. Private Sub BB(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  443. Dim 位置1 As String
  444. 位置1 = 13 + N9 & ":" & 13 + N9 : xlSheet.Rows(位置1).Select : myExcel.Selection.RowHeight = 3
  445. 位置1 = 14 + N9 & ":" & 14 + N9 : xlSheet.Rows(位置1).Select : myExcel.Selection.RowHeight = 30
  446. 位置1 = 15 + N9 & ":" & 15 + N9 : xlSheet.Rows(位置1).Select : myExcel.Selection.RowHeight = 30
  447. 位置1 = 16 + N9 & ":" & 16 + N9 : xlSheet.Rows(位置1).Select : myExcel.Selection.RowHeight = 15
  448. If CheckBox4.Checked = True Then
  449. 位置1 = "A" & 14 + N9 & ":S" & 14 + N9 : xlSheet.Range(位置1).Select()
  450. With myExcel.Selection.Interior : .Pattern = xlSolid : .PatternColorIndex = xlAutomatic : .ThemeColor = xlThemeColorAccent2
  451. .TintAndShade = 0.799981688894314 : .PatternTintAndShade = 0 : End With
  452. Else
  453. 位置1 = "A" & 14 + N9 & ":P" & 14 + N9 : xlSheet.Range(位置1).Select()
  454. With myExcel.Selection.Interior : .Pattern = xlSolid : .PatternColorIndex = xlAutomatic : .ThemeColor = xlThemeColorAccent2
  455. .TintAndShade = 0.799981688894314 : .PatternTintAndShade = 0 : End With
  456. End If
  457. 位置1 = "A" & 16 + N9 & ":AH" & 16 + N9 : xlSheet.Range(位置1).Select()
  458. With myExcel.Selection.Interior : .Pattern = xlSolid : .PatternColorIndex = xlAutomatic : .ThemeColor = xlThemeColorAccent2 : .TintAndShade = 0.799981688894314 : .PatternTintAndShade = 0 : End With
  459. 位置1 = "A" & 14 + N9 & ":A" & 16 + N9 : xlSheet.Range(位置1).Select()
  460. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  461. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  462. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  463. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  464. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  465. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  466. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  467. 位置1 = "B" & 14 + N9 & ":G" & 14 + N9 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  468. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  469. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  470. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  471. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  472. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  473. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  474. 位置1 = "B" & 15 + N9 & ":G" & 15 + N9 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  475. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  476. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  477. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  478. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  479. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  480. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  481. 位置1 = "H" & 14 + N9 & ":J" & 14 + N9 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  482. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  483. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  484. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  485. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  486. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  487. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  488. 位置1 = "H" & 15 + N9 & ":J" & 15 + N9 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  489. myExcel.Selection.Style = "Comma" : myExcel.Selection.NumberFormatLocal = "_-* #,##0.0_-;-* #,##0.0_-;_-* ""-""??_-;_-@_-"
  490. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  491. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  492. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  493. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  494. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  495. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  496. 位置1 = "K" & 14 + N9 & ":M" & 14 + N9 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  497. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  498. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  499. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  500. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  501. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  502. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  503. 位置1 = "K" & 15 + N9 & ":M" & 15 + N9 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  504. myExcel.Selection.Style = "Comma" : myExcel.Selection.NumberFormatLocal = "_-* #,##0.0_-;-* #,##0.0_-;_-* ""-""??_-;_-@_-"
  505. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  506. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  507. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  508. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  509. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  510. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  511. 位置1 = "N" & 14 + N9 & ":P" & 14 + N9 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  512. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  513. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  514. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  515. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  516. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  517. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  518. 位置1 = "N" & 15 + N9 & ":P" & 15 + N9 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  519. myExcel.Selection.Style = "Comma" : myExcel.Selection.NumberFormatLocal = "_-* #,##0.0_-;-* #,##0.0_-;_-* ""-""??_-;_-@_-"
  520. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  521. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  522. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  523. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  524. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  525. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  526. If CheckBox4.Checked = True Then
  527. 位置1 = "Q" & 14 + N9 & ":S" & 14 + N9 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  528. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  529. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  530. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  531. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  532. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  533. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  534. 位置1 = "Q" & 15 + N9 & ":S" & 15 + N9 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  535. myExcel.Selection.Style = "Comma" : myExcel.Selection.NumberFormatLocal = "_-* #,##0.0_-;-* #,##0.0_-;_-* ""-""??_-;_-@_-"
  536. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  537. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  538. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  539. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  540. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  541. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  542. End If
  543. 位置1 = "AB" & 14 + N9 & ":AH" & 15 + N9 : xlSheet.Range(位置1).Select()
  544. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  545. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  546. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  547. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  548. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  549. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  550. 位置1 = "B" & 16 + N9 & ":G" & 16 + N9 : xlSheet.Range(位置1).Select()
  551. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  552. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  553. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  554. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  555. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  556. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  557. 位置1 = "H" & 16 + N9 & ":M" & 16 + N9 : xlSheet.Range(位置1).Select()
  558. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  559. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  560. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  561. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  562. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  563. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  564. 位置1 = "N" & 16 + N9 & ":S" & 16 + N9 : xlSheet.Range(位置1).Select()
  565. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  566. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  567. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  568. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  569. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  570. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  571. 位置1 = "T" & 16 + N9 & ":W" & 16 + N9 : xlSheet.Range(位置1).Select()
  572. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  573. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  574. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  575. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  576. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  577. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  578. 位置1 = "X" & 16 + N9 & ":AH" & 16 + N9 : xlSheet.Range(位置1).Select()
  579. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  580. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  581. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  582. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  583. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  584. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  585. 位置1 = "AB" & 14 + N9 & ":AH" & 15 + N9 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  586. End Sub
  587. Private Sub CC(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  588. Dim 位置1 As String
  589. 位置1 = 17 + N10 & ":" & 17 + N10 : xlSheet.Rows(位置1).Select : myExcel.Selection.RowHeight = 15
  590. 位置1 = "A" & 17 + N10 & ":AH" & 17 + N10 : xlSheet.Range(位置1).Select()
  591. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  592. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  593. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  594. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  595. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  596. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  597. 位置1 = "B" & 17 + N10 & ":G" & 17 + N10 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  598. With myExcel.Selection.Interior : .Pattern = xlSolid : .PatternColorIndex = xlAutomatic : .ThemeColor = xlThemeColorAccent6 : .TintAndShade = 0.799981688894314 : .PatternTintAndShade = 0 : End With
  599. End Sub
  600. Private Sub DD(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  601. Dim 位置1 As String
  602. 位置1 = "A" & 18 + N11 : xlSheet.Range(位置1).Select()
  603. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  604. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  605. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  606. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  607. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  608. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  609. 位置1 = "B" & 18 + N11 & ":G" & 18 + N11 : xlSheet.Range(位置1).Select()
  610. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  611. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  612. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  613. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  614. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  615. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  616. 位置1 = "H" & 18 + N11 & ":M" & 18 + N11 : xlSheet.Range(位置1).Select()
  617. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  618. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  619. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  620. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  621. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  622. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  623. 位置1 = "N" & 18 + N11 & ":S" & 18 + N11 : xlSheet.Range(位置1).Select()
  624. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  625. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  626. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  627. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  628. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  629. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  630. 位置1 = "T" & 18 + N11 & ":W" & 18 + N11 : xlSheet.Range(位置1).Select()
  631. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  632. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  633. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  634. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  635. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  636. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  637. 位置1 = "X" & 18 + N11 & ":AH" & 18 + N11 : xlSheet.Range(位置1).Select()
  638. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  639. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  640. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  641. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  642. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  643. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  644. 位置1 = "B" & 18 + N11 & ":G" & 18 + N11 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  645. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  646. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  647. 位置1 = "H" & 18 + N11 & ":M" & 18 + N11 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  648. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  649. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  650. 位置1 = "N" & 18 + N11 & ":S" & 18 + N11 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  651. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  652. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  653. 位置1 = "T" & 18 + N11 & ":W" & 18 + N11 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  654. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  655. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  656. 位置1 = "X" & 18 + N11 & ":AH" & 18 + N11 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  657. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  658. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  659. 位置1 = 18 + N11 & ":" & 18 + N11 : xlSheet.Rows(位置1).Select
  660. With myExcel.Selection : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : End With
  661. If ww1 = False And ww2 = False Then
  662. 位置1 = 18 + N11 & ":" & 18 + N11 : xlSheet.Rows(位置1).Select : myExcel.Selection.RowHeight = 15
  663. Else
  664. 位置1 = 18 + N11 & ":" & 18 + N11 : xlSheet.Rows(位置1).Select : myExcel.Selection.RowHeight = 30
  665. End If
  666. End Sub
  667. Private Sub EE(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  668. Dim 位置1 As String
  669. 位置1 = "A" & 14 + N9 & ":AH" & 18 + N11 : xlSheet.Range(位置1).Select()
  670. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  671. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  672. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  673. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  674. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  675. End Sub
  676. Private Sub FF(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  677. xlSheet.Columns("A:AH").Select
  678. myExcel.ActiveSheet.PageSetup.PrintArea = "$A:$AH"
  679. myExcel.Application.PrintCommunication = False
  680. With myExcel.ActiveSheet.PageSetup
  681. .PrintTitleRows = "$1:$12"
  682. .PrintTitleColumns = ""
  683. End With
  684. myExcel.Application.PrintCommunication = True
  685. myExcel.ActiveSheet.PageSetup.PrintArea = "$A:$AH"
  686. myExcel.Application.PrintCommunication = False
  687. With myExcel.ActiveSheet.PageSetup
  688. .LeftHeader = ""
  689. .CenterHeader = ""
  690. .RightHeader = ""
  691. .LeftFooter = ""
  692. .CenterFooter = ""
  693. .RightFooter = ""
  694. .LeftMargin = myExcel.Application.InchesToPoints(0.196850393700787)
  695. .RightMargin = myExcel.Application.InchesToPoints(0.196850393700787)
  696. .TopMargin = myExcel.Application.InchesToPoints(0.393700787401575)
  697. .BottomMargin = myExcel.Application.InchesToPoints(0.196850393700787)
  698. .HeaderMargin = myExcel.Application.InchesToPoints(0)
  699. .FooterMargin = myExcel.Application.InchesToPoints(0)
  700. .PrintHeadings = False
  701. .PrintGridlines = False
  702. .PrintQuality = 600
  703. .CenterHorizontally = True
  704. .CenterVertically = False
  705. .Draft = False
  706. .FirstPageNumber = xlAutomatic
  707. .BlackAndWhite = False
  708. .Zoom = False
  709. .FitToPagesWide = 1
  710. .FitToPagesTall = 0
  711. .OddAndEvenPagesHeaderFooter = False
  712. .DifferentFirstPageHeaderFooter = False
  713. .ScaleWithDocHeaderFooter = True
  714. .AlignMarginsHeaderFooter = True
  715. .EvenPage.LeftHeader.Text = ""
  716. .EvenPage.CenterHeader.Text = ""
  717. .EvenPage.RightHeader.Text = ""
  718. .EvenPage.LeftFooter.Text = ""
  719. .EvenPage.CenterFooter.Text = ""
  720. .EvenPage.RightFooter.Text = ""
  721. .FirstPage.LeftHeader.Text = ""
  722. .FirstPage.CenterHeader.Text = ""
  723. .FirstPage.RightHeader.Text = ""
  724. .FirstPage.LeftFooter.Text = ""
  725. .FirstPage.CenterFooter.Text = ""
  726. .FirstPage.RightFooter.Text = ""
  727. End With
  728. myExcel.Application.PrintCommunication = True
  729. End Sub
  730. Private Sub GG(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  731. Dim 位置1 As String
  732. Clipboard.SetDataObject(PictureBox1.Image)
  733. 位置1 = "AB5" : xlSheet.Range(位置1).Select()
  734. myExcel.ActiveSheet.Pictures.Paste.Select
  735. myExcel.Selection.ShapeRange.Height = 79
  736. End Sub
  737. Private Sub HH(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  738. Dim 位置1 As String
  739. Clipboard.SetDataObject(PictureBox1.Image)
  740. 位置1 = "AB" & N9 + 14 : xlSheet.Range(位置1).Select()
  741. myExcel.ActiveSheet.Pictures.Paste.Select
  742. myExcel.Selection.ShapeRange.Height = 59
  743. End Sub
  744. Private Sub CheckBox3_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox3.Click
  745. CheckBox3.Checked = True : CheckBox1.Checked = False : CheckBox2.Checked = False
  746. End Sub
  747. Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.Click
  748. CheckBox3.Checked = False : CheckBox1.Checked = True : CheckBox2.Checked = False
  749. End Sub
  750. Private Sub CheckBox2_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox2.Click
  751. CheckBox3.Checked = False : CheckBox1.Checked = False : CheckBox2.Checked = True
  752. End Sub
  753. Private Sub CheckBox4_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox4.Click
  754. CheckBox4.Checked = True : CheckBox5.Checked = False : CheckBox6.Checked = False
  755. End Sub
  756. Private Sub CheckBox5_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox5.Click
  757. CheckBox4.Checked = False : CheckBox5.Checked = True : CheckBox6.Checked = False
  758. End Sub
  759. Private Sub CheckBox6_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox6.Click
  760. CheckBox4.Checked = False : CheckBox5.Checked = False : CheckBox6.Checked = True
  761. End Sub
  762. End Class