Nessuna descrizione
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.

形體總表MINI WALL.vb 44KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  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. Imports Microsoft.Office.Interop.Excel
  13. Imports System.Threading
  14. Public Class 形體總表MINI_WALL
  15. Dim conn As New SqlConnection
  16. Dim da As New SqlDataAdapter
  17. Dim cmd As New SqlCommand
  18. Dim ds As New DataSet : Dim ds1 As New DataSet : Dim ds2 As New DataSet : Dim ds3 As New DataSet : Dim ds4 As New DataSet
  19. Dim dr As SqlDataReader
  20. Dim AASS As String : Dim SSDD As String
  21. Dim 楦頭最大數 As Integer : Dim 草圖計算數 As Integer : Dim 草圖最大數 As Integer : Dim N1 As Integer : Dim N2 As Integer : Dim 位置1 As String : Dim 位置2 As String : Dim 位置3 As String : Dim 位置4 As String
  22. Dim 位置5 As String : Dim 位置6 As String : Dim 位置7 As String : Dim 位置8 As String : Dim 位置9 As String : Dim 位置10 As String
  23. Dim xlApp As Application
  24. Dim xlBook As Workbook
  25. Dim xlSheet As Worksheet
  26. Private Sub Set_DGV1載入前設定()
  27. DataGridView1.DataSource = Nothing : ds.Clear()
  28. DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  29. DataGridView1.ColumnHeadersHeight = 25
  30. DataGridView1.AllowUserToAddRows = False
  31. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  32. End Sub
  33. Private Sub Set_DGV1載入後設定()
  34. cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : da.Fill(ds) : DataGridView1.DataSource = ds.Tables(0) : conn.Close()
  35. End Sub
  36. Private Sub 草圖表清單()
  37. Set_DGV1載入前設定()
  38. SQL1 = "SELECT 鞋樣素描圖控制表.模具編號, 鞋樣素描圖控制表.型體編號, 鞋樣素描圖控制表.型體名稱, METOO選擇按鈕.選擇 , 鞋樣素描圖控制表.鞋樣素描圖編號
  39. FROM 鞋樣素描圖控制表 LEFT OUTER JOIN METOO選擇按鈕 ON 鞋樣素描圖控制表.楦頭編號 = METOO選擇按鈕.對應
  40. WHERE (鞋樣素描圖控制表.品牌 LIKE '" & ComboBox1.Text & "') AND (鞋樣素描圖控制表.楦頭編號 LIKE '" & AASS & "')"
  41. Set_DGV1載入後設定() : Set_grid()
  42. End Sub
  43. Private Sub Set_grid()
  44. DataGridView1.Columns(0).Width = 120 : DataGridView1.Columns(1).Width = 120 : DataGridView1.Columns(2).Width = 120 : DataGridView1.Columns(3).Width = 40 : DataGridView1.Columns(4).Visible = False
  45. For i As Integer = 0 To DataGridView1.Rows.Count - 1
  46. DataGridView1.Rows(i).Cells("選擇").Value = False
  47. Next i
  48. End Sub
  49. Private Sub Set_DGV2載入前設定()
  50. DataGridView2.DataSource = Nothing : ds1.Clear()
  51. DataGridView2.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  52. DataGridView2.ColumnHeadersHeight = 25
  53. DataGridView2.AllowUserToAddRows = False
  54. DataGridView2.RowTemplate.Height = 60
  55. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  56. End Sub
  57. Private Sub Set_DGV2載入後設定()
  58. cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : da.Fill(ds1) : DataGridView2.DataSource = ds1.Tables(0) : conn.Close()
  59. End Sub
  60. Private Sub Set_清單2()
  61. Set_DGV2載入前設定()
  62. SQL1 = "SELECT 楦頭規格控制表.楦頭名, 楦頭圖片庫.楦頭圖片, 楦頭規格控制表.楦頭編號, MINI_WALL_明細表.製造, MINI_WALL_明細表.選擇
  63. FROM MINI_WALL_明細表 LEFT OUTER JOIN 楦頭規格控制表 ON MINI_WALL_明細表.楦頭編號 = 楦頭規格控制表.楦頭編號 LEFT OUTER JOIN 楦頭圖片庫 ON MINI_WALL_明細表.楦頭編號 = 楦頭圖片庫.楦頭編號
  64. WHERE (MINI_WALL_明細表.MW編號 LIKE N'" & TextBox1.Text & "')"
  65. Set_DGV2載入後設定() : Set_grid1()
  66. End Sub
  67. Private Sub Set_grid1()
  68. DataGridView2.Columns(0).Width = 100 : DataGridView2.Columns(1).Width = 70 : DataGridView2.Columns(2).Visible = False : DataGridView2.Columns(3).Width = 70 : DataGridView2.Columns(4).Width = 40
  69. DataGridView2.EditMode = DataGridViewEditMode.EditOnEnter
  70. Dim mycol As DataGridViewImageColumn = DataGridView2.Columns("楦頭圖片")
  71. mycol.ImageLayout = DataGridViewImageCellLayout.Zoom
  72. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  73. If DataGridView2.Rows(i).Cells("選擇").Value Is DBNull.Value Then
  74. DataGridView2.Rows(i).Cells("選擇").Value = False
  75. End If
  76. Next i
  77. End Sub
  78. Private Sub Set_DGV3載入前設定()
  79. DataGridView3.DataSource = Nothing : ds2.Clear()
  80. DataGridView3.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  81. DataGridView3.ColumnHeadersHeight = 25
  82. DataGridView3.AllowUserToAddRows = False
  83. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  84. End Sub
  85. Private Sub Set_DGV3載入後設定()
  86. cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : da.Fill(ds2) : DataGridView3.DataSource = ds2.Tables(0) : conn.Close()
  87. For i As Integer = 0 To DataGridView3.Rows.Count - 1
  88. DataGridView3.Rows(i).Cells("選擇").Value = False
  89. Next i
  90. End Sub
  91. Private Sub Set_楦頭清單()
  92. Set_DGV3載入前設定()
  93. SQL1 = "SELECT 楦頭規格控制表.楦頭編號, METOO選擇按鈕.選擇
  94. FROM 鞋樣素描圖控制表 LEFT OUTER JOIN METOO選擇按鈕 ON 鞋樣素描圖控制表.楦頭編號 = METOO選擇按鈕.對應 LEFT OUTER JOIN 楦頭規格控制表 ON 鞋樣素描圖控制表.楦頭編號 = 楦頭規格控制表.楦頭編號
  95. WHERE (鞋樣素描圖控制表.品牌 LIKE '" & ComboBox1.Text & "') GROUP BY 楦頭規格控制表.楦頭編號, METOO選擇按鈕.選擇"
  96. Set_DGV3載入後設定() : Set_grid2()
  97. End Sub
  98. Private Sub Set_grid2()
  99. DataGridView3.Columns(0).Width = 120 : DataGridView3.Columns(1).Visible = False
  100. End Sub
  101. Private Sub Set_DGV4載入前設定()
  102. DataGridView4.DataSource = Nothing : ds3.Clear()
  103. DataGridView4.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  104. DataGridView4.ColumnHeadersHeight = 25
  105. DataGridView4.AllowUserToAddRows = False
  106. DataGridView4.RowTemplate.Height = 60
  107. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  108. End Sub
  109. Private Sub Set_DGV4載入後設定()
  110. cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : da.Fill(ds3) : DataGridView4.DataSource = ds3.Tables(0) : conn.Close()
  111. End Sub
  112. Private Sub 清單3()
  113. Set_DGV4載入前設定()
  114. SQL1 = "SELECT 鞋樣素描圖控制表.楦頭編號, 鞋樣素描圖控制表.模具編號, 鞋樣素描圖控制表.型體編號, 鞋樣素描圖控制表.型體名稱,
  115. 鞋樣素描圖控制表.圖片, MINI_WALL_草圖明細.選擇, MINI_WALL_草圖明細.鞋樣素描圖編號
  116. FROM MINI_WALL_草圖明細 LEFT OUTER JOIN 鞋樣素描圖控制表 ON MINI_WALL_草圖明細.鞋樣素描圖編號 = 鞋樣素描圖控制表.鞋樣素描圖編號
  117. WHERE (MINI_WALL_草圖明細.MW編號 LIKE N'" & TextBox1.Text & "') AND (MINI_WALL_草圖明細.楦頭編號 LIKE N'" & AASS & "')"
  118. Set_DGV4載入後設定() : Set_grid3()
  119. End Sub
  120. Private Sub Set_grid3()
  121. DataGridView4.Columns(0).Width = 120 : DataGridView4.Columns(1).Width = 120 : DataGridView4.Columns(2).Width = 120 : DataGridView4.Columns(3).Width = 120 : DataGridView4.Columns(4).Width = 120
  122. DataGridView4.Columns(5).Width = 40 : DataGridView4.Columns(6).Visible = False
  123. Dim mycol As DataGridViewImageColumn = DataGridView4.Columns("圖片")
  124. mycol.ImageLayout = DataGridViewImageCellLayout.Zoom
  125. For i As Integer = 0 To DataGridView4.Rows.Count - 1
  126. If DataGridView4.Rows(i).Cells("選擇").Value Is DBNull.Value Then
  127. DataGridView4.Rows(i).Cells("選擇").Value = False
  128. End If
  129. Next i
  130. End Sub
  131. Private Sub Set_DGV5載入前設定()
  132. DataGridView5.DataSource = Nothing : ds4.Clear()
  133. DataGridView5.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  134. DataGridView5.ColumnHeadersHeight = 25
  135. DataGridView5.AllowUserToAddRows = False
  136. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  137. End Sub
  138. Private Sub Set_DGV5載入後設定()
  139. cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : da.Fill(ds4) : DataGridView5.DataSource = ds4.Tables(0) : conn.Close()
  140. End Sub
  141. Private Sub Set_清單1()
  142. Set_DGV5載入前設定()
  143. SQL1 = "SELECT MW編號, 季節, 品牌 FROM MINI_WALL_控制表 ORDER BY MW編號"
  144. Set_DGV5載入後設定() : Set_grid4()
  145. End Sub
  146. Private Sub Set_grid4()
  147. DataGridView5.Columns(0).Width = 100 : DataGridView5.Columns(1).Width = 60 : DataGridView5.Columns(2).Width = 140
  148. End Sub
  149. Private Sub ComboBox1下拉表單資料載入()
  150. conn.Close()
  151. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  152. SQL1 = "SELECT 客戶簡稱 FROM 型體控制表 GROUP BY 客戶簡稱 ORDER BY 客戶簡稱"
  153. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
  154. ComboBox1.Items.Clear() : While (dr.Read()) : ComboBox1.Items.Add(dr("客戶簡稱")) : End While : conn.Close()
  155. End Sub
  156. Private Sub ComboBox7下拉表單資料載入()
  157. conn.Close()
  158. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  159. SQL1 = "SELECT SEASON FROM 季節清單 ORDER BY SEASON"
  160. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
  161. ComboBox7.Items.Clear() : While (dr.Read()) : ComboBox7.Items.Add(dr("SEASON")) : End While : conn.Close()
  162. End Sub
  163. Private Sub 圖片導入1()
  164. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  165. SQL1 = "SELECT 楦頭圖片 FROM 楦頭圖片庫 WHERE 楦頭編號 LIKE N'" & AASS & "'"
  166. cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
  167. PictureBox1.Image = Nothing
  168. While dr.Read() = True
  169. Dim bytes As Byte() = New Byte(-1) {}
  170. bytes = DirectCast(dr.Item("楦頭圖片"), Byte())
  171. Dim oStream As New MemoryStream(bytes)
  172. PictureBox1.Image = Bitmap.FromStream(oStream)
  173. End While
  174. conn.Close()
  175. PictureBox1.SizeMode = 4
  176. End Sub
  177. Private Sub 圖片導入2()
  178. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  179. SQL1 = "SELECT 圖片 FROM 鞋樣素描圖控制表 WHERE 鞋樣素描圖編號 LIKE N'" & SSDD & "'"
  180. cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
  181. PictureBox2.Image = Nothing
  182. While dr.Read() = True
  183. Dim bytes As Byte() = New Byte(-1) {}
  184. bytes = DirectCast(dr.Item("圖片"), Byte())
  185. Dim oStream As New MemoryStream(bytes)
  186. PictureBox2.Image = Bitmap.FromStream(oStream)
  187. End While
  188. conn.Close()
  189. PictureBox2.SizeMode = 4
  190. End Sub
  191. Private Sub 形體總表MINI_WALL_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  192. Me.MdiParent = WINPROFIT_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
  193. ComboBox1下拉表單資料載入() : ComboBox7下拉表單資料載入() : Set_清單1()
  194. TextBox1.Enabled = False : TextBox2.Enabled = False : TextBox3.Enabled = False
  195. End Sub
  196. Private Sub DataGridView5_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView5.CellClick
  197. If e.RowIndex = -1 Then : Else
  198. TextBox1.Text = DataGridView5.Rows(e.RowIndex).Cells("MW編號").Value : ComboBox7.Text = DataGridView5.Rows(e.RowIndex).Cells("季節").Value
  199. ComboBox1.Text = DataGridView5.Rows(e.RowIndex).Cells("品牌").Value
  200. Set_清單2() : TextBox2.Text = "" : TextBox3.Text = ""
  201. End If
  202. End Sub
  203. Private Sub DataGridView2_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView2.CellClick
  204. If e.RowIndex = -1 Then : Else
  205. AASS = DataGridView2.Rows(e.RowIndex).Cells("楦頭編號").Value
  206. TextBox2.Text = DataGridView2.Rows(e.RowIndex).Cells("楦頭編號").Value
  207. 清單3() : TextBox3.Text = ""
  208. End If
  209. End Sub
  210. Private Sub DataGridView4_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView4.CellClick
  211. If e.RowIndex = -1 Then : Else
  212. TextBox3.Text = DataGridView4.Rows(e.RowIndex).Cells("鞋樣素描圖編號").Value
  213. End If
  214. End Sub
  215. Private Sub DataGridView3_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView3.CellClick
  216. If e.RowIndex = -1 Then : Else
  217. AASS = DataGridView3.Rows(e.RowIndex).Cells("楦頭編號").Value
  218. 草圖表清單() : 圖片導入1()
  219. End If
  220. End Sub
  221. Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
  222. If e.RowIndex = -1 Then : Else
  223. SSDD = DataGridView1.Rows(e.RowIndex).Cells("鞋樣素描圖編號").Value
  224. 圖片導入2()
  225. End If
  226. End Sub
  227. Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
  228. Set_楦頭清單()
  229. End Sub
  230. Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  231. 清單修改.Close() : 季節清單修改 = True : 清單修改.ShowDialog() : ComboBox7下拉表單資料載入() : 季節清單修改 = False
  232. End Sub
  233. Private Sub Button29_Click(sender As Object, e As EventArgs) Handles Button29.Click
  234. If ComboBox7.Text = "" Or ComboBox1.Text = "" Then
  235. MsgBox("季節與品牌沒有選擇")
  236. Else
  237. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  238. SQL1 = "SELECT TOP (1) MW編號 FROM MINI_WALL_控制表 GROUP BY MW編號 ORDER BY MW編號 DESC"
  239. cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
  240. If dr.Read() Then : TextBox1.Text = dr("MW編號").ToString : Else : TextBox1.Text = "MW00000000" : End If
  241. conn.Close()
  242. Dim NUM1 As Integer
  243. NUM1 = Double.Parse(Strings.Right(TextBox1.Text, 8)) + 1
  244. If NUM1 < 10 Then : TextBox1.Text = "MW" & "0000000" & NUM1
  245. ElseIf NUM1 > 9 And NUM1 < 100 Then : TextBox1.Text = "MW" & "000000" & NUM1
  246. ElseIf NUM1 > 99 And NUM1 < 1000 Then : TextBox1.Text = "MW" & "00000" & NUM1
  247. ElseIf NUM1 > 999 And NUM1 < 10000 Then : TextBox1.Text = "MW" & "0000" & NUM1
  248. ElseIf NUM1 > 9999 And NUM1 < 100000 Then : TextBox1.Text = "MW" & "000" & NUM1
  249. ElseIf NUM1 > 99999 And NUM1 < 100000 Then : TextBox1.Text = "MW" & "00" & NUM1
  250. ElseIf NUM1 > 999999 And NUM1 < 1000000 Then : TextBox1.Text = "MW" & "0" & NUM1
  251. ElseIf NUM1 > 9999999 Then : TextBox1.Text = "MW" & NUM1 + 1
  252. End If
  253. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  254. SQL1 = "INSERT INTO MINI_WALL_控制表 (MW編號, 季節, 品牌) VALUES (N'" & TextBox1.Text & "', N'" & ComboBox7.Text & "', N'" & ComboBox1.Text & "')"
  255. cmd.Connection = conn : cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
  256. MsgBox("MINI WALL主體準備完畢") : Set_清單1()
  257. End If
  258. End Sub
  259. Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
  260. For i As Integer = 0 To DataGridView1.Rows.Count - 1 : DataGridView1.Rows(i).Cells("選擇").Value = True : Next i
  261. End Sub
  262. Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
  263. For i As Integer = 0 To DataGridView1.Rows.Count - 1 : DataGridView1.Rows(i).Cells("選擇").Value = False : Next i
  264. End Sub
  265. Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
  266. For i As Integer = 0 To DataGridView2.Rows.Count - 1 : DataGridView2.Rows(i).Cells("選擇").Value = True : Next i
  267. End Sub
  268. Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click
  269. For i As Integer = 0 To DataGridView2.Rows.Count - 1 : DataGridView2.Rows(i).Cells("選擇").Value = False : Next i
  270. End Sub
  271. Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
  272. For i As Integer = 0 To DataGridView4.Rows.Count - 1 : DataGridView4.Rows(i).Cells("選擇").Value = True : Next i
  273. End Sub
  274. Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
  275. For i As Integer = 0 To DataGridView4.Rows.Count - 1 : DataGridView4.Rows(i).Cells("選擇").Value = False : Next i
  276. End Sub
  277. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  278. If AASS = "" Then
  279. MsgBox("沒有選擇楦頭")
  280. Else
  281. Dim DDFF As Boolean
  282. For i As Integer = 0 To DataGridView1.Rows.Count - 1
  283. DDFF = DataGridView1.Rows(i).Cells("選擇").Value = True
  284. If DDFF = True Then
  285. Exit For
  286. ElseIf i = DataGridView1.Rows.Count - 1 And DDFF = False Then
  287. MsgBox("沒有選擇鞋樣素描") : Exit For
  288. End If
  289. Next i
  290. If DDFF = True Then
  291. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  292. SQL1 = "SELECT MW編號 FROM MINI_WALL_明細表 WHERE MW編號 LIKE N'" & TextBox1.Text & "' AND 楦頭編號 LIKE N'" & AASS & "'"
  293. cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
  294. If dr.Read() Then : Else
  295. conn.Close()
  296. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  297. SQL1 = "INSERT INTO MINI_WALL_明細表 (MW編號, 楦頭編號) VALUES (N'" & TextBox1.Text & "', N'" & AASS & "')"
  298. cmd.Connection = conn : cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
  299. End If
  300. conn.Close()
  301. For i As Integer = 0 To DataGridView1.Rows.Count - 1
  302. 資料數 = DataGridView1.Rows.Count : MyModule1.進度條()
  303. If DataGridView1.Rows(i).Cells("選擇").Value = True Then
  304. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  305. SQL1 = "SELECT MW編號 FROM MINI_WALL_草圖明細
  306. WHERE MW編號 LIKE N'" & TextBox1.Text & "' AND 楦頭編號 LIKE N'" & AASS & "' AND 鞋樣素描圖編號 LIKE N'" & DataGridView1.Rows(i).Cells("鞋樣素描圖編號").Value & "'"
  307. cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
  308. If dr.Read() Then : Else
  309. conn.Close()
  310. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  311. SQL1 = "INSERT INTO MINI_WALL_草圖明細 (MW編號, 楦頭編號, 鞋樣素描圖編號)
  312. VALUES (N'" & TextBox1.Text & "', N'" & AASS & "', N'" & DataGridView1.Rows(i).Cells("鞋樣素描圖編號").Value & "')"
  313. cmd.Connection = conn : cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
  314. End If
  315. conn.Close()
  316. Else : End If
  317. Next i : WINPROFIT_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  318. Set_清單2() : 清單3() : AASS = "" : DDFF = False
  319. MsgBox("新增完成")
  320. End If
  321. End If
  322. End Sub
  323. Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
  324. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  325. 資料數 = DataGridView2.Rows.Count : MyModule1.進度條()
  326. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  327. SQL1 = "UPDATE MINI_WALL_明細表 SET 選擇 = N'" & DataGridView2.Rows(i).Cells("選擇").Value & "', 製造 = N'" & DataGridView2.Rows(i).Cells("製造").Value & "'
  328. WHERE (MW編號 LIKE N'" & TextBox1.Text & "' AND 楦頭編號 LIKE N'" & DataGridView2.Rows(i).Cells("楦頭編號").Value & "')"
  329. cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
  330. Next i : WINPROFIT_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  331. MsgBox("存檔完成")
  332. End Sub
  333. Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
  334. For i As Integer = 0 To DataGridView4.Rows.Count - 1
  335. 資料數 = DataGridView4.Rows.Count : MyModule1.進度條()
  336. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  337. SQL1 = "UPDATE MINI_WALL_草圖明細 SET 選擇 = N'" & DataGridView4.Rows(i).Cells("選擇").Value & "'
  338. WHERE (MW編號 LIKE N'" & TextBox1.Text & "' AND 鞋樣素描圖編號 LIKE N'" & DataGridView4.Rows(i).Cells("鞋樣素描圖編號").Value & "')"
  339. cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
  340. Next i : WINPROFIT_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  341. MsgBox("存檔完成")
  342. End Sub
  343. Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click
  344. Dim aa As MsgBoxResult
  345. aa = MsgBox("確定要刪除該筆資料?", MsgBoxStyle.OkCancel)
  346. If aa = MsgBoxResult.Ok Then
  347. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  348. SQL1 = "DELETE FROM MINI_WALL_控制表 WHERE (MW編號 LIKE N'" & TextBox1.Text & "')"
  349. cmd.CommandText = SQL1 : cmd.Connection = conn : cmd.ExecuteNonQuery() : conn.Close()
  350. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  351. SQL1 = "DELETE FROM MINI_WALL_明細表 WHERE (MW編號 LIKE N'" & TextBox1.Text & "')"
  352. cmd.CommandText = SQL1 : cmd.Connection = conn : cmd.ExecuteNonQuery() : conn.Close()
  353. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  354. SQL1 = "DELETE FROM MINI_WALL_草圖明細 WHERE (MW編號 LIKE N'" & TextBox1.Text & "')"
  355. cmd.CommandText = SQL1 : cmd.Connection = conn : cmd.ExecuteNonQuery() : conn.Close()
  356. MsgBox("刪除完成") : Set_清單1() : Set_清單2() : 清單3()
  357. End If
  358. End Sub
  359. Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
  360. Dim aa As MsgBoxResult
  361. aa = MsgBox("確定要刪除該筆資料?", MsgBoxStyle.OkCancel)
  362. If aa = MsgBoxResult.Ok Then
  363. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  364. SQL1 = "DELETE FROM MINI_WALL_明細表 WHERE (MW編號 LIKE N'" & TextBox1.Text & "' AND 楦頭編號 LIKE N'" & TextBox2.Text & "')"
  365. cmd.CommandText = SQL1 : cmd.Connection = conn : cmd.ExecuteNonQuery() : conn.Close()
  366. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  367. SQL1 = "DELETE FROM MINI_WALL_草圖明細 WHERE (MW編號 LIKE N'" & TextBox1.Text & "' AND 楦頭編號 LIKE N'" & TextBox2.Text & "')"
  368. cmd.CommandText = SQL1 : cmd.Connection = conn : cmd.ExecuteNonQuery() : conn.Close()
  369. MsgBox("刪除完成") : Set_清單2() : 清單3()
  370. End If
  371. End Sub
  372. Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
  373. Dim aa As MsgBoxResult
  374. aa = MsgBox("確定要刪除該筆資料?", MsgBoxStyle.OkCancel)
  375. If aa = MsgBoxResult.Ok Then
  376. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  377. SQL1 = "DELETE FROM MINI_WALL_草圖明細 WHERE (MW編號 LIKE N'" & TextBox1.Text & "' AND 鞋樣素描圖編號 LIKE N'" & TextBox3.Text & "')"
  378. cmd.CommandText = SQL1 : cmd.Connection = conn : cmd.ExecuteNonQuery() : conn.Close()
  379. MsgBox("刪除完成") : Set_清單2() : 清單3()
  380. End If
  381. End Sub
  382. Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
  383. 楦頭最大數 = 0 : 草圖最大數 = 0
  384. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  385. If DataGridView2.Rows(i).Cells("選擇").Value = True Then
  386. 楦頭最大數 += 1
  387. Set_DGV4載入前設定()
  388. SQL1 = "SELECT 鞋樣素描圖控制表.楦頭編號, 鞋樣素描圖控制表.模具編號, 鞋樣素描圖控制表.型體編號, 鞋樣素描圖控制表.型體名稱,
  389. 鞋樣素描圖控制表.圖片, MINI_WALL_草圖明細.選擇, MINI_WALL_草圖明細.鞋樣素描圖編號
  390. FROM MINI_WALL_草圖明細 LEFT OUTER JOIN 鞋樣素描圖控制表 ON MINI_WALL_草圖明細.鞋樣素描圖編號 = 鞋樣素描圖控制表.鞋樣素描圖編號
  391. WHERE (MINI_WALL_草圖明細.MW編號 LIKE N'" & TextBox1.Text & "') AND (MINI_WALL_草圖明細.楦頭編號 LIKE N'" & DataGridView2.Rows(i).Cells("楦頭編號").Value & "')"
  392. Set_DGV4載入後設定() : Set_grid3()
  393. 草圖計算數 = 0
  394. For ii As Integer = 0 To DataGridView4.Rows.Count - 1
  395. If DataGridView4.Rows(ii).Cells("選擇").Value = True Then
  396. 草圖計算數 += 1
  397. End If
  398. Next ii
  399. If 草圖計算數 > 草圖最大數 Then
  400. 草圖最大數 = 草圖計算數
  401. End If
  402. End If
  403. Next i
  404. xlApp = CType(CreateObject("Excel.Application"), Application)
  405. xlBook = xlApp.Workbooks.Add
  406. xlApp.DisplayAlerts = True
  407. xlBook.Activate()
  408. xlSheet = NewMethod(xlBook)
  409. xlSheet.Activate()
  410. xlApp.Visible = True
  411. xlApp.Application.WindowState = xlMaximized
  412. xlSheet.Cells(1, 1) = ComboBox1.Text & " - " & ComboBox7.Text & " - MINI WALL" : AA(xlApp, xlSheet) : N1 = 0
  413. For I As Integer = 0 To 草圖最大數 - 1
  414. xlSheet.Cells(10 + N1, 1) = "Sketch" : xlSheet.Cells(11 + N1, 1) = "STYLE #" : xlSheet.Cells(12 + N1, 1) = "STYLE NAME"
  415. xlSheet.Cells(13 + N1, 1) = "LAST #" : xlSheet.Cells(14 + N1, 1) = "OUTSOLE #"
  416. BB(xlApp, xlSheet) : JJ(xlApp, xlSheet)
  417. N1 += 5
  418. Next
  419. N2 = 0
  420. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  421. If DataGridView2.Rows(i).Cells("選擇").Value = True Then
  422. DD(xlApp, xlSheet)
  423. AASS = DataGridView2.Rows(i).Cells("楦頭編號").Value : 圖片導入1()
  424. If CheckBox1.Checked = True Then
  425. xlSheet.Cells(3, 2 + N2) = DataGridView2.Rows(i).Cells("製造").Value
  426. End If
  427. xlSheet.Cells(8, 2 + N2) = DataGridView2.Rows(i).Cells("楦頭名").Value
  428. FF(xlApp, xlSheet)
  429. For ii As Integer = 0 To 999999999
  430. If PictureBox1.Image Is Nothing Then
  431. Else
  432. CC(xlApp, xlSheet)
  433. ii = 999999999
  434. End If
  435. Next
  436. Set_DGV4載入前設定()
  437. SQL1 = "SELECT 鞋樣素描圖控制表.楦頭編號, 鞋樣素描圖控制表.模具編號, 鞋樣素描圖控制表.型體編號, 鞋樣素描圖控制表.型體名稱,
  438. 鞋樣素描圖控制表.圖片, MINI_WALL_草圖明細.選擇, MINI_WALL_草圖明細.鞋樣素描圖編號
  439. FROM MINI_WALL_草圖明細 LEFT OUTER JOIN 鞋樣素描圖控制表 ON MINI_WALL_草圖明細.鞋樣素描圖編號 = 鞋樣素描圖控制表.鞋樣素描圖編號
  440. WHERE (MINI_WALL_草圖明細.MW編號 LIKE N'" & TextBox1.Text & "') AND (MINI_WALL_草圖明細.楦頭編號 LIKE N'" & DataGridView2.Rows(i).Cells("楦頭編號").Value & "')"
  441. Set_DGV4載入後設定() : Set_grid3()
  442. N1 = 0
  443. For ii As Integer = 0 To DataGridView4.Rows.Count - 1
  444. If DataGridView4.Rows(ii).Cells("選擇").Value = True Then
  445. SSDD = DataGridView4.Rows(ii).Cells("鞋樣素描圖編號").Value
  446. 圖片導入2()
  447. xlSheet.Cells(11 + N1, 2 + N2) = DataGridView4.Rows(ii).Cells("型體編號").Value : xlSheet.Cells(12 + N1, 2 + N2) = DataGridView4.Rows(ii).Cells("型體名稱").Value
  448. xlSheet.Cells(13 + N1, 2 + N2) = DataGridView4.Rows(ii).Cells("楦頭編號").Value : xlSheet.Cells(14 + N1, 2 + N2) = DataGridView4.Rows(ii).Cells("模具編號").Value
  449. GG(xlApp, xlSheet)
  450. For iii As Integer = 0 To 999999999
  451. If PictureBox2.Image Is Nothing Then
  452. Else
  453. EE(xlApp, xlSheet)
  454. iii = 999999999
  455. End If
  456. Next
  457. N1 += 5
  458. End If
  459. Next
  460. N2 += 2
  461. End If
  462. Next
  463. HH(xlApp, xlSheet)
  464. xlSheet.PageSetup.PrintArea = ""
  465. xlApp.Cells.Select()
  466. xlSheet.Range("B1").Select()
  467. xlApp.Application.WindowState = xlMinimized
  468. MsgBox("列印完成")
  469. PictureBox1.Image = Nothing : PictureBox2.Image = Nothing : DataGridView2.DataSource = Nothing : ds1.Clear() : DataGridView4.DataSource = Nothing : ds3.Clear()
  470. End Sub
  471. Private Shared Function NewMethod(xlBook As Workbook) As Worksheet
  472. Return CType(xlBook.Worksheets.Add, Worksheet)
  473. End Function
  474. Private Sub RTFGRTFG()
  475. If N2 = 0 Then : 位置1 = "B6" : 位置3 = "C"
  476. ElseIf N2 = 2 Then : 位置1 = "D6" : 位置3 = "E" : ElseIf N2 = 4 Then : 位置1 = "F6" : 位置3 = "G" : ElseIf N2 = 6 Then : 位置1 = "H6" : 位置3 = "I"
  477. ElseIf N2 = 8 Then : 位置1 = "J6" : 位置3 = "K" : ElseIf N2 = 10 Then : 位置1 = "L6" : 位置3 = "M" : ElseIf N2 = 12 Then : 位置1 = "N6" : 位置3 = "O"
  478. ElseIf N2 = 14 Then : 位置1 = "P6" : 位置3 = "Q" : ElseIf N2 = 16 Then : 位置1 = "R6" : 位置3 = "S" : ElseIf N2 = 18 Then : 位置1 = "T6" : 位置3 = "U"
  479. ElseIf N2 = 20 Then : 位置1 = "V6" : 位置3 = "W" : ElseIf N2 = 22 Then : 位置1 = "X6" : 位置3 = "Y" : ElseIf N2 = 24 Then : 位置1 = "Z6" : 位置3 = "AA"
  480. ElseIf N2 = 26 Then : 位置1 = "AB6" : 位置3 = "AC" : ElseIf N2 = 28 Then : 位置1 = "AD6" : 位置3 = "AE" : ElseIf N2 = 30 Then : 位置1 = "AF6" : 位置3 = "AG"
  481. ElseIf N2 = 32 Then : 位置1 = "AH6" : 位置3 = "AI" : ElseIf N2 = 34 Then : 位置1 = "AJ6" : 位置3 = "AK" : ElseIf N2 = 36 Then : 位置1 = "AL6" : 位置3 = "AM"
  482. ElseIf N2 = 38 Then : 位置1 = "AN6" : 位置3 = "AO" : ElseIf N2 = 40 Then : 位置1 = "AP6" : 位置3 = "AQ" : ElseIf N2 = 42 Then : 位置1 = "AR6" : 位置3 = "AS"
  483. ElseIf N2 = 44 Then : 位置1 = "AT6" : 位置3 = "AU" : ElseIf N2 = 46 Then : 位置1 = "AV6" : 位置3 = "AW" : ElseIf N2 = 48 Then : 位置1 = "AX6" : 位置3 = "AY"
  484. ElseIf N2 = 50 Then : 位置1 = "AZ6" : 位置3 = "BA" : ElseIf N2 = 52 Then : 位置1 = "BB6" : 位置3 = "BC" : ElseIf N2 = 54 Then : 位置1 = "BD6" : 位置3 = "BE"
  485. ElseIf N2 = 56 Then : 位置1 = "BF6" : 位置3 = "BG" : ElseIf N2 = 58 Then : 位置1 = "BH6" : 位置3 = "BI" : ElseIf N2 = 60 Then : 位置1 = "BJ6" : 位置3 = "BK"
  486. ElseIf N2 = 62 Then : 位置1 = "BL6" : 位置3 = "BM" : ElseIf N2 = 64 Then : 位置1 = "BN6" : 位置3 = "BO" : ElseIf N2 = 66 Then : 位置1 = "BP6" : 位置3 = "BQ"
  487. ElseIf N2 = 68 Then : 位置1 = "BR6" : 位置3 = "BS" : ElseIf N2 = 70 Then : 位置1 = "BT6" : 位置3 = "BU" : ElseIf N2 = 72 Then : 位置1 = "BV6" : 位置3 = "BW"
  488. ElseIf N2 = 74 Then : 位置1 = "BX6" : 位置3 = "BY" : ElseIf N2 = 76 Then : 位置1 = "BZ6" : 位置3 = "CA" : ElseIf N2 = 78 Then : 位置1 = "CB6" : 位置3 = "CC"
  489. ElseIf N2 = 80 Then : 位置1 = "DD6" : 位置3 = "CE" : End If
  490. If N2 > 24 Then
  491. 位置2 = Strings.Left(位置1, 2) & ":" & Strings.Left(位置1, 2) : 位置3 = Strings.Left(位置3, 2) & ":" & Strings.Left(位置3, 2) : 位置4 = Strings.Left(位置1, 2) & 10 + N1
  492. 位置5 = Strings.Left(位置1, 2) & "6:" & Strings.Left(位置1, 2) & "9" : 位置6 = Strings.Left(位置1, 2) & 10 + N1 & ":" & Strings.Left(位置1, 2) & 14 + N1
  493. 位置7 = "A1:" & Strings.Left(位置3, 2) & 1 : 位置8 = "B3:" & Strings.Left(位置1, 2) & 3 : 位置9 = "A6:" & Strings.Left(位置3, 2) & 5 * 草圖最大數 + 9
  494. ElseIf N2 = 24 Then
  495. 位置2 = Strings.Left(位置1, 1) & ":" & Strings.Left(位置1, 1) : 位置3 = Strings.Left(位置3, 2) & ":" & Strings.Left(位置3, 2) : 位置4 = Strings.Left(位置1, 1) & 10 + N1
  496. 位置5 = Strings.Left(位置1, 1) & "6:" & Strings.Left(位置1, 1) & "9" : 位置6 = Strings.Left(位置1, 1) & 10 + N1 & ":" & Strings.Left(位置1, 1) & 14 + N1
  497. 位置7 = "A1:" & Strings.Left(位置3, 2) & 1 : 位置8 = "B3:" & Strings.Left(位置1, 1) & 3 : 位置9 = "A6:" & Strings.Left(位置3, 2) & 5 * 草圖最大數 + 9
  498. ElseIf N2 < 24 Then
  499. 位置2 = Strings.Left(位置1, 1) & ":" & Strings.Left(位置1, 1) : 位置3 = Strings.Left(位置3, 1) & ":" & Strings.Left(位置3, 1) : 位置4 = Strings.Left(位置1, 1) & 10 + N1
  500. 位置5 = Strings.Left(位置1, 1) & "6:" & Strings.Left(位置1, 1) & "9" : 位置6 = Strings.Left(位置1, 1) & 10 + N1 & ":" & Strings.Left(位置1, 1) & 14 + N1
  501. 位置7 = "A1:" & Strings.Left(位置3, 1) & 1 : 位置8 = "B3:" & Strings.Left(位置1, 1) & 3 : 位置9 = "A6:" & Strings.Left(位置3, 1) & 5 * 草圖最大數 + 9
  502. End If
  503. End Sub
  504. Private Sub AA(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  505. xlSheet.Cells.Select()
  506. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  507. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  508. xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 15
  509. xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 25 : xlSheet.Rows("2:2").Select : myExcel.Selection.RowHeight = 5
  510. xlSheet.Rows("3:3").Select : myExcel.Selection.RowHeight = 25 : xlSheet.Rows("4:5").Select : myExcel.Selection.RowHeight = 5
  511. xlSheet.Rows("6:6").Select : myExcel.Selection.RowHeight = 90 : xlSheet.Rows("7:7").Select : myExcel.Selection.RowHeight = 5
  512. xlSheet.Rows("9:9").Select : myExcel.Selection.RowHeight = 5
  513. End Sub
  514. Private Sub BB(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  515. xlSheet.Rows(10 + N1 & ":" & 10 + N1).Select : myExcel.Selection.RowHeight = 90
  516. End Sub
  517. Private Sub CC(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  518. RTFGRTFG()
  519. Clipboard.SetDataObject(PictureBox1.Image)
  520. Thread.Sleep(100) '延迟0.1秒
  521. xlSheet.Range(位置1).Select()
  522. myExcel.ActiveSheet.Paste
  523. If PictureBox1.Image.Height < PictureBox1.Image.Width Then
  524. myExcel.Selection.ShapeRange.Width = 90
  525. Else
  526. myExcel.Selection.ShapeRange.Height = 85
  527. End If
  528. myExcel.Selection.ShapeRange.IncrementLeft(2)
  529. myExcel.Selection.ShapeRange.IncrementTop(2)
  530. End Sub
  531. Private Sub DD(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  532. RTFGRTFG()
  533. xlSheet.Columns(位置2).Select : myExcel.Selection.ColumnWidth = 15
  534. xlSheet.Columns(位置3).Select : myExcel.Selection.ColumnWidth = 1
  535. End Sub
  536. Private Sub EE(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  537. RTFGRTFG()
  538. Clipboard.SetDataObject(PictureBox2.Image)
  539. xlSheet.Cells(1, 1).Select
  540. Thread.Sleep(100) '延迟0.1秒
  541. xlSheet.Range(位置4).Select()
  542. myExcel.ActiveSheet.Paste
  543. If PictureBox2.Image.Height < PictureBox2.Image.Width Then
  544. myExcel.Selection.ShapeRange.Width = 90
  545. Else
  546. myExcel.Selection.ShapeRange.Height = 85
  547. End If
  548. myExcel.Selection.ShapeRange.IncrementLeft(2)
  549. myExcel.Selection.ShapeRange.IncrementTop(2)
  550. End Sub
  551. Private Sub FF(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  552. RTFGRTFG()
  553. xlSheet.Range(位置5).Select()
  554. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  555. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  556. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  557. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  558. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  559. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  560. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  561. End Sub
  562. Private Sub GG(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  563. RTFGRTFG()
  564. xlSheet.Range(位置6).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. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  571. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  572. End Sub
  573. Private Sub HH(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  574. N2 = 楦頭最大數 * 2 - 2
  575. RTFGRTFG()
  576. xlSheet.Cells.Select()
  577. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  578. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  579. xlSheet.Range(位置7).Select()
  580. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  581. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  582. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  583. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  584. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  585. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  586. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  587. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  588. xlSheet.Range(位置8).Select()
  589. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  590. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  591. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  592. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  593. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  594. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  595. xlSheet.Range(位置9).Select()
  596. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  597. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  598. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  599. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  600. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  601. myExcel.ActiveWindow.DisplayGridlines = False
  602. End Sub
  603. Private Sub JJ(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  604. 位置10 = "A" & 10 + N1 & ":A" & 14 + N1
  605. xlSheet.Range(位置10).Select()
  606. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  607. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  608. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  609. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  610. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  611. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  612. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  613. End Sub
  614. End Class