暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

樣品物料調料單申請.vb 39KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  1. Option Strict Off
  2. Imports System.Data.SqlClient
  3. Imports Microsoft.Office.Interop.Excel.XlUnderlineStyle
  4. Imports Microsoft.Office.Interop.Excel.Constants
  5. Imports Microsoft.Office.Interop.Excel.XlBordersIndex
  6. Imports Microsoft.Office.Interop.Excel.XlLineStyle
  7. Imports Microsoft.Office.Interop.Excel.XlBorderWeight
  8. Imports Microsoft.Office.Interop.Excel.XlThemeFont
  9. Imports Microsoft.Office.Interop.Excel.XlThemeColor
  10. Imports Microsoft.Office.Interop.Excel.XlWindowState
  11. Imports Microsoft.Office.Interop.Excel
  12. Imports System.Threading
  13. Public Class 樣品物料調料單申請
  14. Dim conn As New SqlConnection
  15. Dim da As New SqlDataAdapter
  16. Dim cmd As New SqlCommand
  17. Dim ds As New DataSet : Dim ds1 As New DataSet : Dim ds2 As New DataSet
  18. Dim dr As SqlDataReader
  19. Dim DTP As String : Dim DTP1 As String : Dim 新項次 As String : Dim NUM1 As Integer
  20. Dim xlApp As Application
  21. Dim xlBook As Workbook
  22. Dim xlSheet As Worksheet
  23. Dim 位置1 As String : Dim N1 As Integer
  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() : Set_grid()
  33. End Sub
  34. Private Sub Set_清單()
  35. Set_DGV1載入前設定()
  36. If PA = "" Then
  37. SQL1 = "SELECT 樣品物料調料單抬頭.調料單號, 供應商清單.廠商, 樣品物料調料單抬頭.客戶, 樣品物料調料單抬頭.SHOW年,
  38. 樣品物料調料單抬頭.SHOW月, 樣品物料調料單抬頭.日期, 樣品物料調料單抬頭.發件人, 樣品物料調料單抬頭.收件人,
  39. 樣品物料調料單抬頭.制表人, 樣品物料調料單抬頭.核准簽名, 樣品物料調料單抬頭.供應商編號
  40. FROM 樣品物料調料單抬頭 INNER JOIN
  41. 供應商清單 ON 樣品物料調料單抬頭.供應商編號 = 供應商清單.供應商編碼
  42. WHERE (樣品物料調料單抬頭.核准簽名 LIKE '')
  43. ORDER BY 樣品物料調料單抬頭.SHOW年, 樣品物料調料單抬頭.SHOW月"
  44. Else
  45. SQL1 = "SELECT 樣品物料調料單抬頭.調料單號, 供應商清單.廠商, 樣品物料調料單抬頭.客戶, 樣品物料調料單抬頭.SHOW年,
  46. 樣品物料調料單抬頭.SHOW月, 樣品物料調料單抬頭.日期, 樣品物料調料單抬頭.發件人, 樣品物料調料單抬頭.收件人,
  47. 樣品物料調料單抬頭.制表人, 樣品物料調料單抬頭.核准簽名, 樣品物料調料單抬頭.供應商編號
  48. FROM 樣品物料調料單抬頭 INNER JOIN
  49. 供應商清單 ON 樣品物料調料單抬頭.供應商編號 = 供應商清單.供應商編碼
  50. WHERE (樣品物料調料單抬頭.核准簽名 LIKE '') AND ((樣品物料調料單抬頭.調料單號 LIKE N'%" & PA & "%') OR (供應商清單.廠商 LIKE N'%" & PA & "%') OR (樣品物料調料單抬頭.客戶 LIKE N'%" & PA & "%') OR
  51. (樣品物料調料單抬頭.SHOW年 LIKE N'%" & PA & "%') OR (樣品物料調料單抬頭.SHOW月 LIKE N'%" & PA & "%') OR (樣品物料調料單抬頭.日期 LIKE N'%" & PA & "%') OR
  52. (樣品物料調料單抬頭.發件人 LIKE N'%" & PA & "%') OR (樣品物料調料單抬頭.收件人 LIKE N'%" & PA & "%') OR (樣品物料調料單抬頭.制表人 LIKE N'%" & PA & "%'))
  53. ORDER BY 樣品物料調料單抬頭.SHOW年, 樣品物料調料單抬頭.SHOW月"
  54. End If
  55. Set_DGV1載入後設定()
  56. End Sub
  57. Private Sub Set_grid()
  58. DataGridView1.Columns(0).Width = 110 : DataGridView1.Columns(1).Width = 130 : DataGridView1.Columns(2).Width = 130 : DataGridView1.Columns(3).Width = 70 : DataGridView1.Columns(4).Width = 70
  59. DataGridView1.Columns(5).Visible = False : DataGridView1.Columns(6).Visible = False : DataGridView1.Columns(7).Visible = False : DataGridView1.Columns(8).Visible = False
  60. DataGridView1.Columns(9).Visible = False : DataGridView1.Columns(10).Visible = False
  61. End Sub
  62. Private Sub Set_使用者清單()
  63. DataGridView2.DataSource = Nothing : ds1.Clear()
  64. DataGridView2.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  65. DataGridView2.ColumnHeadersHeight = 25
  66. DataGridView2.AllowUserToAddRows = False
  67. DataGridView2.RowTemplate.Height = 35
  68. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  69. SQL1 = "SELECT 調料單號, 項次, 名稱, 規格, 顏色, 單位, 數量, 單價, 數量 * 單價 AS 金額, 備註 FROM 樣品物料調料單明細 WHERE 調料單號 LIKE N'" & TextBox1.Text & "' ORDER BY 項次"
  70. cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : da.Fill(ds1) : DataGridView2.DataSource = ds1.Tables(0) : conn.Close() : Set_grid1()
  71. End Sub
  72. Private Sub Set_grid1()
  73. DataGridView2.Columns(0).Visible = False : DataGridView2.Columns(1).Width = 80 : DataGridView2.Columns(2).Width = 200 : DataGridView2.Columns(3).Width = 200 : DataGridView2.Columns(4).Width = 200
  74. DataGridView2.Columns(5).Width = 80 : DataGridView2.Columns(6).Width = 80 : DataGridView2.Columns(7).Width = 80 : DataGridView2.Columns(8).Width = 80 : DataGridView2.Columns(9).Width = 305
  75. DataGridView2.Columns(8).DefaultCellStyle.Format = "#,##0.00" : DataGridView2.Columns(6).DefaultCellStyle.Format = "#,##0.00" : DataGridView2.Columns(7).DefaultCellStyle.Format = "#,##0.00"
  76. DataGridView2.Columns(8).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : DataGridView2.Columns(6).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
  77. DataGridView2.Columns(7).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
  78. DataGridView2.Columns(8).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight : DataGridView2.Columns(6).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
  79. DataGridView2.Columns(7).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
  80. DataGridView2.EditMode = DataGridViewEditMode.EditOnEnter
  81. TextBox5.Text = "0.00"
  82. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  83. TextBox5.Text = Val(TextBox5.Text) + DataGridView2.Rows(i).Cells("金額").Value
  84. Next i
  85. TextBox5.Text = Strings.Format(Val(TextBox5.Text), "#,##0.00")
  86. End Sub
  87. Private Sub ComboBox1下拉表單資料載入()
  88. conn.Close()
  89. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  90. SQL1 = "SELECT 廠商, 供應商編碼 FROM 供應商清單 ORDER BY 廠商"
  91. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
  92. ComboBox1.Items.Clear() : ComboBox2.Items.Clear()
  93. While (dr.Read()) : ComboBox1.Items.Add(dr("廠商")) : ComboBox2.Items.Add(dr("供應商編碼")) : End While : conn.Close()
  94. End Sub
  95. Private Sub ComboBox3下拉表單資料載入()
  96. conn.Close()
  97. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  98. SQL1 = "SELECT 姓名 FROM 使用者權限管理表 WHERE (CC49 = 0) ORDER BY 姓名"
  99. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
  100. ComboBox3.Items.Clear() : ComboBox4.Items.Clear()
  101. While (dr.Read()) : ComboBox3.Items.Add(dr("姓名")) : ComboBox4.Items.Add(dr("姓名")) : End While : conn.Close()
  102. End Sub
  103. Private Sub ComboBox5下拉表單資料載入()
  104. conn.Close()
  105. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  106. SQL1 = "SELECT 年份 FROM 年份清單 ORDER BY 年份"
  107. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
  108. ComboBox5.Items.Clear() : While (dr.Read()) : ComboBox5.Items.Add(dr("年份")) : End While : conn.Close()
  109. End Sub
  110. Private Sub ComboBox7下拉表單資料載入()
  111. conn.Close()
  112. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  113. SQL1 = "SELECT 客戶簡稱 FROM 客戶控制表 ORDER BY 客戶簡稱"
  114. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
  115. ComboBox7.Items.Clear() : While (dr.Read()) : ComboBox7.Items.Add(dr("客戶簡稱")) : End While : conn.Close()
  116. End Sub
  117. Private Sub Set_日期格式轉換()
  118. DTP = Strings.Format(DateTimePicker1.Value, "yyyy/MM/dd") : DTP1 = Strings.Format(Today(), "yyyyMMdd")
  119. End Sub
  120. Private Sub 樣品物料調料單_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  121. Me.MdiParent = WINPROFIT_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
  122. Set_清單() : ComboBox1下拉表單資料載入() : ComboBox3下拉表單資料載入() : ComboBox5下拉表單資料載入() : ComboBox7下拉表單資料載入()
  123. Button2.Enabled = False : Button6.Enabled = False : Button15.Enabled = False : Button3.Enabled = False : Button4.Enabled = False : Button5.Enabled = False
  124. TextBox1.Enabled = False : TextBox6.Enabled = False
  125. End Sub
  126. Private Sub 樣品物料調料單_Unload(sender As Object, e As EventArgs) Handles MyBase.Closing
  127. If Button2.Enabled = True Then
  128. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  129. SQL1 = "DELETE FROM 樣品物料調料單抬頭 WHERE (調料單號 LIKE N'" & TextBox1.Text & "')"
  130. cmd.CommandText = SQL1 : cmd.Connection = conn : cmd.ExecuteNonQuery() : conn.Close()
  131. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  132. SQL1 = "DELETE FROM 樣品物料調料單明細 WHERE (調料單號 LIKE N'" & TextBox1.Text & "')"
  133. cmd.CommandText = SQL1 : cmd.Connection = conn : cmd.ExecuteNonQuery() : conn.Close()
  134. End If
  135. End Sub
  136. Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
  137. If e.RowIndex = -1 Then : Else
  138. TextBox1.Text = DataGridView1.Rows(e.RowIndex).Cells("調料單號").Value.ToString : Button3.Enabled = True : Button5.Enabled = True
  139. ComboBox2.Text = DataGridView1.Rows(e.RowIndex).Cells("供應商編號").Value : ComboBox3.Text = DataGridView1.Rows(e.RowIndex).Cells("發件人").Value
  140. ComboBox4.Text = DataGridView1.Rows(e.RowIndex).Cells("收件人").Value : DateTimePicker1.Value = DataGridView1.Rows(e.RowIndex).Cells("日期").Value
  141. TextBox7.Text = DataGridView1.Rows(e.RowIndex).Cells("制表人").Value : ComboBox7.Text = DataGridView1.Rows(e.RowIndex).Cells("客戶").Value
  142. ComboBox5.Text = DataGridView1.Rows(e.RowIndex).Cells("SHOW年").Value : ComboBox6.Text = DataGridView1.Rows(e.RowIndex).Cells("SHOW月").Value
  143. Set_使用者清單()
  144. End If
  145. End Sub
  146. Private Sub DataGridView2_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView2.CellClick
  147. If e.RowIndex = -1 Then : Else
  148. TextBox6.Text = DataGridView2.Rows(e.RowIndex).Cells("項次").Value
  149. End If
  150. End Sub
  151. Private Sub DataGridView2_CellContentClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView2.CellEndEdit
  152. TextBox5.Text = "0.00"
  153. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  154. DataGridView2.Rows(i).Cells("金額").Value = Val(DataGridView2.Rows(i).Cells("數量").Value) * Val(DataGridView2.Rows(i).Cells("單價").Value)
  155. TextBox5.Text = Val(TextBox5.Text) + DataGridView2.Rows(i).Cells("金額").Value
  156. Next i
  157. TextBox5.Text = Strings.Format(Val(TextBox5.Text), "#,##0.00")
  158. End Sub
  159. Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
  160. If Label62.Visible = True Then : Label62.Visible = False : Else : Label62.Visible = True : End If
  161. End Sub
  162. Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
  163. ComboBox2.SelectedIndex = ComboBox1.SelectedIndex
  164. End Sub
  165. Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox2.SelectedIndexChanged
  166. ComboBox1.SelectedIndex = ComboBox2.SelectedIndex
  167. conn.Close()
  168. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  169. SQL1 = "SELECT 公司名, 公司電話1, 聯繫人1 FROM 供應商清單 WHERE (供應商編碼 LIKE '" & ComboBox2.Text & "') ORDER BY 廠商"
  170. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
  171. If dr.Read() Then : TextBox2.Text = dr("公司名") : TextBox3.Text = dr("聯繫人1") : TextBox4.Text = dr("公司電話1") : End If
  172. conn.Close()
  173. End Sub
  174. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  175. Timer1.Enabled = True : DataGridView1.Enabled = False
  176. Button1.Enabled = False : Button2.Enabled = True : Button6.Enabled = True : Button15.Enabled = True
  177. Set_日期格式轉換() : Dim NUM1 As Integer
  178. For i As Integer = 1 To 999
  179. NUM1 = 0 + i
  180. If NUM1 < 10 Then : TextBox1.Text = "L-" & DTP1 & "-00" & NUM1
  181. ElseIf NUM1 > 9 And NUM1 < 100 Then : TextBox1.Text = "L-" & DTP1 & "-0" & NUM1
  182. ElseIf NUM1 > 99 Then : TextBox1.Text = "L-" & DTP1 & "-" & NUM1
  183. End If
  184. conn.Close()
  185. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  186. SQL1 = "SELECT TOP (1) 調料單號 FROM 樣品物料調料單抬頭 WHERE ( 調料單號 LIKE N'" & TextBox1.Text & "')"
  187. cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
  188. If dr.Read() Then
  189. Else
  190. i = 999
  191. conn.Close()
  192. End If
  193. conn.Close()
  194. Next
  195. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  196. SQL1 = "INSERT INTO 樣品物料調料單抬頭 (調料單號, 日期, 發件人, 收件人, 客戶, 制表人, 核准簽名, 供應商編號, SHOW年, SHOW月) " &
  197. "VALUES (N'" & TextBox1.Text & "',N'" & DTP & "',N'',N'',N'',N'',N'',N'',N'',N'')"
  198. cmd.Connection = conn : cmd.CommandText = SQL1 : cmd.ExecuteNonQuery()
  199. DataGridView2.DataSource = Nothing : ds1.Clear()
  200. conn.Close()
  201. End Sub
  202. Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
  203. Dim aa As MsgBoxResult
  204. aa = MsgBox("確定要刪除該筆資料?", MsgBoxStyle.OkCancel)
  205. If aa = MsgBoxResult.Ok Then
  206. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  207. SQL1 = "DELETE FROM 樣品物料調料單抬頭 WHERE (調料單號 LIKE N'" & TextBox1.Text & "')"
  208. cmd.CommandText = SQL1 : cmd.Connection = conn : cmd.ExecuteNonQuery() : conn.Close()
  209. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  210. SQL1 = "DELETE FROM 樣品物料調料單明細 WHERE (調料單號 LIKE N'" & TextBox1.Text & "')"
  211. cmd.CommandText = SQL1 : cmd.Connection = conn : cmd.ExecuteNonQuery() : conn.Close()
  212. TextBox1.Text = "" : TextBox2.Text = "" : TextBox3.Text = "" : TextBox4.Text = ""
  213. ComboBox1下拉表單資料載入() : ComboBox3下拉表單資料載入() : ComboBox5下拉表單資料載入() : ComboBox7下拉表單資料載入()
  214. DataGridView2.DataSource = Nothing : ds1.Clear()
  215. Set_清單()
  216. End If
  217. End Sub
  218. Private Sub 存檔1()
  219. Set_日期格式轉換()
  220. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  221. SQL1 = "UPDATE 樣品物料調料單抬頭 SET 日期 = N'" & DTP & "', 發件人 = N'" & ComboBox3.Text & "', 收件人 = N'" & ComboBox4.Text & "', 客戶 = N'" & ComboBox7.Text &
  222. "', 制表人 = N'" & gUserName & "', 供應商編號 = N'" & ComboBox2.Text & "', SHOW年 = N'" & ComboBox5.Text & "', SHOW月 = N'" & ComboBox6.Text &
  223. "' WHERE (調料單號 LIKE N'" & TextBox1.Text & "')"
  224. cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
  225. End Sub
  226. Private Sub 存檔()
  227. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  228. 資料數 = DataGridView2.Rows.Count : MyModule1.進度條()
  229. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  230. SQL1 = "UPDATE 樣品物料調料單明細 SET 名稱 = N'" & DataGridView2.Rows(i).Cells("名稱").Value & "', 規格 = N'" & DataGridView2.Rows(i).Cells("規格").Value &
  231. "', 顏色 = N'" & DataGridView2.Rows(i).Cells("顏色").Value & "', 單位 = N'" & DataGridView2.Rows(i).Cells("單位").Value & "', 數量 = N'" & DataGridView2.Rows(i).Cells("數量").Value &
  232. "', 單價 = N'" & DataGridView2.Rows(i).Cells("單價").Value & "', 備註 = N'" & DataGridView2.Rows(i).Cells("備註").Value &
  233. "' WHERE (調料單號 LIKE N'" & TextBox1.Text & "' AND 項次 LIKE N'" & DataGridView2.Rows(i).Cells("項次").Value & "')"
  234. cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
  235. Next : WINPROFIT_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  236. End Sub
  237. Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
  238. 存檔()
  239. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  240. SQL1 = "SELECT TOP(1) 項次 FROM 樣品物料調料單明細 WHERE 調料單號 LIKE N'" & TextBox1.Text & "' ORDER BY 項次 DESC"
  241. cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
  242. If dr.Read() Then : 新項次 = dr("項次") : Else : 新項次 = "00" : End If : conn.Close()
  243. NUM1 = Double.Parse(新項次) + 1
  244. If NUM1 < 10 Then : 新項次 = "0" & NUM1
  245. ElseIf NUM1 > 9 And NUM1 < 100 Then : 新項次 = NUM1
  246. End If
  247. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  248. SQL1 = "INSERT INTO 樣品物料調料單明細 (調料單號, 項次, 名稱, 規格, 顏色, 單位, 數量, 單價, 備註) " &
  249. "VALUES (N'" & TextBox1.Text & "',N'" & 新項次 & "',N'',N'',N'',N'',N'0',N'0',N'')"
  250. cmd.Connection = conn : cmd.CommandText = SQL1 : cmd.ExecuteNonQuery()
  251. Set_使用者清單()
  252. End Sub
  253. Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click
  254. If TextBox6.Text = "" Then
  255. MsgBox("未選擇需要刪除的資料")
  256. Else
  257. 存檔()
  258. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  259. SQL1 = "DELETE FROM 樣品物料調料單明細 WHERE (調料單號 LIKE N'" & TextBox1.Text & "' AND 項次 LIKE N'" & TextBox6.Text & "')"
  260. cmd.CommandText = SQL1 : cmd.Connection = conn : cmd.ExecuteNonQuery() : conn.Close()
  261. Set_使用者清單()
  262. Dim NUM1 As Integer = 0
  263. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  264. NUM1 = NUM1 + 1 : If NUM1 < 10 Then : 新項次 = "0" & NUM1 : ElseIf NUM1 > 9 And NUM1 < 100 Then : 新項次 = NUM1 : End If
  265. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  266. SQL1 = "UPDATE 樣品物料調料單明細 SET 項次 = N'" & 新項次 & "' WHERE (調料單號 LIKE N'" & TextBox1.Text & "' AND 項次 LIKE N'" & DataGridView2.Rows(i).Cells("項次").Value & "')"
  267. cmd.CommandText = SQL1 : cmd.ExecuteNonQuery()
  268. conn.Close()
  269. Next
  270. Set_使用者清單()
  271. End If
  272. End Sub
  273. Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  274. DataGridView1.Enabled = True
  275. If ComboBox1.Text = "" Or ComboBox3.Text = "" Or ComboBox4.Text = "" Or ComboBox5.Text = "" Or ComboBox6.Text = "" Or ComboBox7.Text = "" Then
  276. MsgBox("所有的下拉清單都要選擇,請重新確定資料是否正確。")
  277. Else
  278. If TextBox2.Text = "" Or TextBox3.Text = "" Or TextBox4.Text = "" Then
  279. MsgBox("供應商資料內容有缺失,請先完善供應商資料。")
  280. Else
  281. Timer1.Enabled = False : Label62.Visible = False
  282. Button1.Enabled = True : Button2.Enabled = False : Button6.Enabled = False : Button15.Enabled = False
  283. 存檔1() : 存檔() : TextBox7.Text = gUserName
  284. MsgBox("申請完成,請通知主管核準。") : Set_清單()
  285. End If
  286. End If
  287. End Sub
  288. Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
  289. Button3.Enabled = False : Button4.Enabled = True : Button6.Enabled = True : Button15.Enabled = True : Timer1.Enabled = True
  290. DataGridView1.Enabled = False
  291. End Sub
  292. Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
  293. If ComboBox1.Text = "" Or ComboBox3.Text = "" Or ComboBox4.Text = "" Or ComboBox5.Text = "" Or ComboBox6.Text = "" Or ComboBox7.Text = "" Then
  294. MsgBox("所有的下拉清單都要選擇,請重新確定資料是否正確。")
  295. Else
  296. If TextBox2.Text = "" Or TextBox3.Text = "" Or TextBox4.Text = "" Then
  297. MsgBox("供應商資料內容有缺失,請先完善供應商資料。")
  298. Else
  299. DataGridView1.Enabled = True
  300. Timer1.Enabled = False : Label62.Visible = False
  301. Button3.Enabled = True : Button4.Enabled = False : Button6.Enabled = False : Button15.Enabled = False
  302. 存檔1() : 存檔() : TextBox7.Text = gUserName
  303. MsgBox("申請完成,請通知主管核準。") : Set_清單()
  304. End If
  305. End If
  306. End Sub
  307. Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
  308. xlApp = CType(CreateObject("Excel.Application"), Application)
  309. xlBook = xlApp.Workbooks.Add
  310. xlApp.DisplayAlerts = True
  311. xlBook.Activate()
  312. xlSheet = NewMethod(xlBook)
  313. xlSheet.Activate()
  314. xlApp.Visible = True
  315. xlApp.Application.WindowState = xlMaximized
  316. xlSheet.Cells(1, 1) = "森康鞋業有限公司
  317. SenKang Footwear Ltd."
  318. xlSheet.Cells(3, 1) = "廣東東莞市厚街鎮湖景大道南150米 TEL:0769-38851258 FAX:0769-38851259" : xlSheet.Cells(6, 1) = "MATERIALS REQUEST FORM" : xlSheet.Cells(7, 1) = " 物料调料单"
  319. xlSheet.Cells(8, 1) = "Purchase NO#" : xlSheet.Cells(8, 3) = TextBox1.Text : xlSheet.Cells(10, 1) = "TO:" : xlSheet.Cells(10, 2) = TextBox2.Text
  320. xlSheet.Cells(11, 1) = "ATTN:" : xlSheet.Cells(11, 2) = TextBox3.Text : xlSheet.Cells(12, 1) = "TEL:" : xlSheet.Cells(12, 2) = TextBox4.Text
  321. xlSheet.Cells(10, 10) = "DATE:" : xlSheet.Cells(10, 11) = DateTimePicker1.Value : xlSheet.Cells(11, 10) = "FROM:" : xlSheet.Cells(11, 11) = ComboBox3.Text
  322. xlSheet.Cells(12, 10) = "EXT:" : xlSheet.Cells(12, 11) = ComboBox4.Text : xlSheet.Cells(14, 1) = "PLS ALWAYS REFER TO OUR PO#请于送货单上注明我们的订单号码"
  323. xlSheet.Cells(16, 1) = "Item" : xlSheet.Cells(16, 2) = "Description" : xlSheet.Cells(16, 4) = "Spec" : xlSheet.Cells(16, 6) = "Color" : xlSheet.Cells(16, 7) = "Unit"
  324. xlSheet.Cells(16, 8) = "Q'TY" : xlSheet.Cells(16, 9) = "Unit Price" : xlSheet.Cells(16, 10) = "Amount" : xlSheet.Cells(16, 11) = "Remark" : xlSheet.Cells(17, 1) = "项次"
  325. xlSheet.Cells(17, 2) = "名称" : xlSheet.Cells(17, 4) = "規格" : xlSheet.Cells(17, 6) = "颜色" : xlSheet.Cells(17, 7) = "单位" : xlSheet.Cells(17, 8) = "数量"
  326. xlSheet.Cells(17, 9) = "单价" : xlSheet.Cells(17, 10) = "金额" : xlSheet.Cells(17, 11) = "备注"
  327. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  328. xlSheet.Cells(i + 18, 1) = DataGridView2.Rows(i).Cells("項次").Value : xlSheet.Cells(i + 18, 2) = DataGridView2.Rows(i).Cells("名稱").Value
  329. xlSheet.Cells(i + 18, 4) = DataGridView2.Rows(i).Cells("規格").Value : xlSheet.Cells(i + 18, 6) = DataGridView2.Rows(i).Cells("顏色").Value
  330. xlSheet.Cells(i + 18, 7) = DataGridView2.Rows(i).Cells("單位").Value : xlSheet.Cells(i + 18, 8) = DataGridView2.Rows(i).Cells("數量").Value
  331. xlSheet.Cells(i + 18, 9) = DataGridView2.Rows(i).Cells("單價").Value : xlSheet.Cells(i + 18, 10) = DataGridView2.Rows(i).Cells("金額").Value
  332. xlSheet.Cells(i + 18, 11) = DataGridView2.Rows(i).Cells("備註").Value
  333. With xlApp.Selection
  334. .Font.Bold = True
  335. End With
  336. N1 = i + 18
  337. Next i
  338. xlSheet.Cells(N1 + 1, 6) = "TOTAL:" : xlSheet.Cells(N1 + 1, 8) = "=SUM(H18:H" & N1 & ")" : xlSheet.Cells(N1 + 1, 10) = "=SUM(J18:J" & N1 & ")" : xlSheet.Cells(N1 + 2, 4) = "'AMOUNT金额(大写):"
  339. xlSheet.Cells(N1 + 2, 8) = "=J" & N1 + 1 : xlSheet.Cells(N1 + 3, 3) = "FOR" : xlSheet.Cells(N1 + 3, 4) = ComboBox7.Text : xlSheet.Cells(N1 + 3, 7) = ComboBox5.Text : xlSheet.Cells(N1 + 3, 9) = "SHOW"
  340. xlSheet.Cells(N1 + 3, 8) = ComboBox6.Text : xlSheet.Cells(N1 + 5, 1) = "样品请寄:廣東東莞市厚街鎮湖景大道南150米森康鞋業有限公司 人名 電話 收。"
  341. xlSheet.Cells(N1 + 7, 1) = "IMPORTANT: **请回复交期并提供物料报价" : xlSheet.Cells(N1 + 11, 3) = "驗證碼" : xlSheet.Cells(N1 + 11, 4) = "" : xlSheet.Cells(N1 + 12, 3) = "核准:"
  342. xlSheet.Cells(N1 + 12, 10) = "制表人:" : xlSheet.Cells(N1 + 12, 11) = TextBox7.Text
  343. AA(xlApp, xlSheet)
  344. xlSheet.PageSetup.PrintArea = ""
  345. xlApp.Cells.Select()
  346. xlSheet.Range("B1").Select()
  347. xlApp.Application.WindowState = xlMinimized
  348. xlApp.ActiveSheet.Protect(DrawingObjects:=True, Contents:=True, Scenarios:=True, Password:="0911274990")
  349. xlApp.ActiveSheet.EnableSelection = 1
  350. MsgBox("列印完成")
  351. End Sub
  352. Private Shared Function NewMethod(xlBook As Workbook) As Worksheet
  353. Return CType(xlBook.Worksheets.Add, Worksheet)
  354. End Function
  355. Private Sub AA(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  356. xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 5.86 : xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 8
  357. xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 30 : xlSheet.Columns("D:E").Select : myExcel.Selection.ColumnWidth = 10
  358. xlSheet.Columns("F:F").Select : myExcel.Selection.ColumnWidth = 20 : xlSheet.Columns("G:G").Select : myExcel.Selection.ColumnWidth = 6.47
  359. xlSheet.Columns("H:H").Select : myExcel.Selection.ColumnWidth = 10 : xlSheet.Columns("I:I").Select : myExcel.Selection.ColumnWidth = 12
  360. xlSheet.Columns("J:J").Select : myExcel.Selection.ColumnWidth = 12 : xlSheet.Columns("K:K").Select : myExcel.Selection.ColumnWidth = 25.14
  361. xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 86 : xlSheet.Rows("2:2").Select : myExcel.Selection.RowHeight = 8.25
  362. xlSheet.Rows("4:5").Select : myExcel.Selection.RowHeight = 8.25 : xlSheet.Rows("9:9").Select : myExcel.Selection.RowHeight = 8.25
  363. xlSheet.Rows("13:13").Select : myExcel.Selection.RowHeight = 8.25 : xlSheet.Rows("14:14").Select : myExcel.Selection.RowHeight = 25
  364. xlSheet.Rows("15:15").Select : myExcel.Selection.RowHeight = 8.25
  365. xlSheet.Range("A1:K1").Select() : myExcel.Selection.Merge
  366. With myExcel.Selection.Font : .Name = "新細明體" : .Size = 28 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  367. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontMinor : End With
  368. xlSheet.Range("A3:K3").Select() : myExcel.Selection.Merge : myExcel.Selection.Font.Bold = True
  369. xlSheet.Range("A6:K6").Select() : myExcel.Selection.Merge : myExcel.Selection.Font.Bold = True
  370. xlSheet.Range("A7:K7").Select() : myExcel.Selection.Merge : myExcel.Selection.Font.Bold = True
  371. xlSheet.Range("B10:I10").Select() : myExcel.Selection.Merge
  372. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  373. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  374. xlSheet.Range("B11:I11").Select() : myExcel.Selection.Merge
  375. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  376. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  377. xlSheet.Range("B12:I12").Select() : myExcel.Selection.Merge
  378. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  379. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  380. xlSheet.Range("K10").Select()
  381. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  382. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  383. xlSheet.Rows("14:14").Select : myExcel.Selection.Font.Bold = True
  384. xlSheet.Range("B16:C16").Select() : myExcel.Selection.Merge : xlSheet.Range("D16:E16").Select() : myExcel.Selection.Merge
  385. xlSheet.Range("B17:C17").Select() : myExcel.Selection.Merge : xlSheet.Range("D17:E17").Select() : myExcel.Selection.Merge
  386. xlSheet.Range("A16:K17").Select() : myExcel.Selection.Font.Bold = True
  387. xlSheet.Rows("8:8").Select : myExcel.Selection.Font.Bold = True
  388. 位置1 = "18:" & N1 : xlSheet.Range(位置1).Select() : myExcel.Selection.RowHeight = 35.25
  389. 位置1 = N1 + 5 & ":" & N1 + 5 : xlSheet.Range(位置1).Select() : myExcel.Selection.RowHeight = 35.25 : 位置1 = N1 + 1 & ":" & N1 + 3 : xlSheet.Range(位置1).Select() : myExcel.Selection.RowHeight = 20
  390. 位置1 = N1 + 4 & ":" & N1 + 4 : xlSheet.Range(位置1).Select() : myExcel.Selection.RowHeight = 8.5 : 位置1 = N1 + 6 & ":" & N1 + 6 : xlSheet.Range(位置1).Select() : myExcel.Selection.RowHeight = 8.5
  391. 位置1 = N1 + 8 & ":" & N1 + 10 : xlSheet.Range(位置1).Select() : myExcel.Selection.RowHeight = 8.5
  392. For i As Integer = 18 To N1
  393. xlSheet.Range("B" & i & ":C" & i & "").Select() : myExcel.Selection.Merge : xlSheet.Range("D" & i & ":E" & i & "").Select() : myExcel.Selection.Merge
  394. xlSheet.Range("H" & i & ":J" & i & "").Select() : myExcel.Selection.Style = "Comma"
  395. Next i
  396. xlSheet.Rows("18:" & N1 + 2).Select
  397. With myExcel.Selection.Font : .Name = "新細明體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  398. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontMinor : End With
  399. xlSheet.Range("C" & N1 + 3).Select()
  400. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  401. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  402. xlSheet.Range("D" & N1 + 3 & ":F" & N1 + 3).Select() : myExcel.Selection.Merge
  403. xlSheet.Range("A" & N1 + 5 & ":K" & N1 + 5).Select() : myExcel.Selection.Merge
  404. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  405. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  406. xlSheet.Range("A16:K" & N1).Select()
  407. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  408. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  409. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  410. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  411. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  412. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  413. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  414. xlSheet.Range("A4:K4").Select()
  415. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  416. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  417. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  418. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  419. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  420. xlSheet.Range("A9:K9").Select()
  421. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  422. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  423. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  424. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  425. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  426. xlSheet.Range("A12:K12").Select()
  427. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  428. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  429. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  430. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  431. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  432. xlSheet.Range("D" & N1 + 2 & ":G" & N1 + 2).Select() : myExcel.Selection.Merge
  433. xlSheet.Range("H" & N1 + 2 & ":J" & N1 + 2).Select() : myExcel.Selection.Merge
  434. xlSheet.Range("H" & N1 + 2 & ":J" & N1 + 2).Select() : myExcel.Selection.NumberFormatLocal = "[DBNum2][$-zh-CN]G/通用格式"
  435. myExcel.ActiveWindow.Zoom = 80 : myExcel.ActiveWindow.DisplayGridlines = False
  436. xlSheet.Range("C" & N1 + 11).Select()
  437. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  438. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  439. xlSheet.Range("C" & N1 + 12).Select()
  440. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  441. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  442. xlSheet.Range("A" & N1 + 5 & ":K" & N1 + 5).Select()
  443. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  444. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  445. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  446. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  447. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  448. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  449. xlSheet.Range("A7:K7").Select()
  450. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  451. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  452. xlSheet.Range("A6:K6").Select()
  453. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  454. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  455. xlSheet.Range("A3:K3").Select()
  456. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  457. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  458. xlSheet.Range("A1:K1").Select()
  459. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  460. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  461. xlSheet.Range("N12").Select()
  462. xlSheet.Range("B18:C" & N1).Select()
  463. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  464. .ShrinkToFit = False : .ReadingOrder = xlContext : End With
  465. xlSheet.Range("D18:F" & N1).Select()
  466. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  467. .ShrinkToFit = False : .ReadingOrder = xlContext : End With
  468. End Sub
  469. End Class