Aucune description
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

樣品物料調料單一覽表.vb 29KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  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 樣品物料調料單一覽表
  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
  19. Dim dr As SqlDataReader
  20. Dim DTP As String : Dim DTP1 As String : Dim 新項次 As String : Dim NUM1 As Integer
  21. Dim QQW(11) As String : Dim II As Integer
  22. Dim xlApp As Application
  23. Dim xlBook As Workbook
  24. Dim xlSheet As Worksheet
  25. Dim 位置1 As String : Dim N1 As Integer
  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() : Set_grid()
  35. End Sub
  36. Private Sub Set_清單()
  37. Set_DGV1載入前設定()
  38. If PA = "" Then
  39. SQL1 = "SELECT 樣品物料調料單抬頭.調料單號, 供應商清單.廠商, 樣品物料調料單抬頭.客戶, 樣品物料調料單抬頭.SHOW年,
  40. 樣品物料調料單抬頭.SHOW月, 樣品物料調料單抬頭.日期, 樣品物料調料單抬頭.發件人, 樣品物料調料單抬頭.收件人,
  41. 樣品物料調料單抬頭.制表人, 樣品物料調料單抬頭.核准簽名, 樣品物料調料單抬頭.供應商編號, 樣品物料調料單抬頭.驗證碼
  42. FROM 樣品物料調料單抬頭 INNER JOIN
  43. 供應商清單 ON 樣品物料調料單抬頭.供應商編號 = 供應商清單.供應商編碼
  44. WHERE (樣品物料調料單抬頭.核准簽名 NOT LIKE '')
  45. ORDER BY 樣品物料調料單抬頭.SHOW年 DESC, 樣品物料調料單抬頭.SHOW月 DESC"
  46. Else
  47. SQL1 = "SELECT 樣品物料調料單抬頭.調料單號, 供應商清單.廠商, 樣品物料調料單抬頭.客戶, 樣品物料調料單抬頭.SHOW年,
  48. 樣品物料調料單抬頭.SHOW月, 樣品物料調料單抬頭.日期, 樣品物料調料單抬頭.發件人, 樣品物料調料單抬頭.收件人,
  49. 樣品物料調料單抬頭.制表人, 樣品物料調料單抬頭.核准簽名, 樣品物料調料單抬頭.供應商編號, 樣品物料調料單抬頭.驗證碼
  50. FROM 樣品物料調料單抬頭 INNER JOIN
  51. 供應商清單 ON 樣品物料調料單抬頭.供應商編號 = 供應商清單.供應商編碼
  52. WHERE (樣品物料調料單抬頭.核准簽名 NOT LIKE '') AND ((樣品物料調料單抬頭.調料單號 LIKE N'%" & PA & "%') OR (供應商清單.廠商 LIKE N'%" & PA & "%') OR (樣品物料調料單抬頭.客戶 LIKE N'%" & PA & "%') OR
  53. (樣品物料調料單抬頭.SHOW年 LIKE N'%" & PA & "%') OR (樣品物料調料單抬頭.SHOW月 LIKE N'%" & PA & "%') OR (樣品物料調料單抬頭.日期 LIKE N'%" & PA & "%') OR
  54. (樣品物料調料單抬頭.發件人 LIKE N'%" & PA & "%') OR (樣品物料調料單抬頭.收件人 LIKE N'%" & PA & "%') OR (樣品物料調料單抬頭.制表人 LIKE N'%" & PA & "%'))
  55. ORDER BY 樣品物料調料單抬頭.SHOW年, 樣品物料調料單抬頭.SHOW月"
  56. End If
  57. Set_DGV1載入後設定()
  58. End Sub
  59. Private Sub Set_grid()
  60. 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
  61. DataGridView1.Columns(5).Visible = False : DataGridView1.Columns(6).Visible = False : DataGridView1.Columns(7).Visible = False : DataGridView1.Columns(8).Visible = False
  62. DataGridView1.Columns(9).Visible = False : DataGridView1.Columns(10).Visible = False : DataGridView1.Columns(11).Visible = False
  63. End Sub
  64. Private Sub Set_使用者清單()
  65. DataGridView2.DataSource = Nothing : ds1.Clear()
  66. DataGridView2.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  67. DataGridView2.ColumnHeadersHeight = 25
  68. DataGridView2.AllowUserToAddRows = False
  69. DataGridView2.RowTemplate.Height = 35
  70. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  71. SQL1 = "SELECT 調料單號, 項次, 名稱, 規格, 顏色, 單位, 數量, 單價, 數量 * 單價 AS 金額, 備註 FROM 樣品物料調料單明細 WHERE 調料單號 LIKE N'" & TextBox1.Text & "' ORDER BY 項次"
  72. cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : da.Fill(ds1) : DataGridView2.DataSource = ds1.Tables(0) : conn.Close() : Set_grid1()
  73. End Sub
  74. Private Sub Set_grid1()
  75. 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
  76. 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
  77. DataGridView2.Columns(8).DefaultCellStyle.Format = "#,##0.00" : DataGridView2.Columns(6).DefaultCellStyle.Format = "#,##0.00" : DataGridView2.Columns(7).DefaultCellStyle.Format = "#,##0.00"
  78. DataGridView2.Columns(8).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : DataGridView2.Columns(6).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
  79. DataGridView2.Columns(7).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
  80. DataGridView2.Columns(8).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight : DataGridView2.Columns(6).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
  81. DataGridView2.Columns(7).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
  82. DataGridView2.EditMode = DataGridViewEditMode.EditOnEnter
  83. TextBox5.Text = "0.00"
  84. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  85. TextBox5.Text = Val(TextBox5.Text) + DataGridView2.Rows(i).Cells("金額").Value
  86. Next i
  87. TextBox5.Text = Strings.Format(Val(TextBox5.Text), "#,##0.00")
  88. End Sub
  89. Private Sub ComboBox1下拉表單資料載入()
  90. conn.Close()
  91. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  92. SQL1 = "SELECT 廠商, 供應商編碼 FROM 供應商清單 ORDER BY 廠商"
  93. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
  94. ComboBox1.Items.Clear() : ComboBox2.Items.Clear()
  95. While (dr.Read()) : ComboBox1.Items.Add(dr("廠商")) : ComboBox2.Items.Add(dr("供應商編碼")) : End While : conn.Close()
  96. End Sub
  97. Private Sub ComboBox3下拉表單資料載入()
  98. conn.Close()
  99. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  100. SQL1 = "SELECT 姓名 FROM 使用者權限管理表 WHERE (CC49 = 0) ORDER BY 姓名"
  101. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
  102. ComboBox3.Items.Clear() : ComboBox4.Items.Clear()
  103. While (dr.Read()) : ComboBox3.Items.Add(dr("姓名")) : ComboBox4.Items.Add(dr("姓名")) : End While : conn.Close()
  104. End Sub
  105. Private Sub ComboBox5下拉表單資料載入()
  106. conn.Close()
  107. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  108. SQL1 = "SELECT 年份 FROM 年份清單 ORDER BY 年份"
  109. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
  110. ComboBox5.Items.Clear() : While (dr.Read()) : ComboBox5.Items.Add(dr("年份")) : End While : conn.Close()
  111. End Sub
  112. Private Sub ComboBox7下拉表單資料載入()
  113. conn.Close()
  114. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  115. SQL1 = "SELECT 客戶簡稱 FROM 客戶控制表 ORDER BY 客戶簡稱"
  116. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
  117. ComboBox7.Items.Clear() : While (dr.Read()) : ComboBox7.Items.Add(dr("客戶簡稱")) : End While : conn.Close()
  118. End Sub
  119. Private Sub Set_日期格式轉換()
  120. DTP = Strings.Format(DateTimePicker1.Value, "yyyy/MM/dd") : DTP1 = Strings.Format(Today(), "yyyyMMdd")
  121. End Sub
  122. Private Sub 樣品物料調料單一覽表_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  123. Me.MdiParent = WINPROFIT_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
  124. Set_清單() : ComboBox1下拉表單資料載入() : ComboBox3下拉表單資料載入() : ComboBox5下拉表單資料載入() : ComboBox7下拉表單資料載入()
  125. Button3.Enabled = False : TextBox1.Enabled = False
  126. End Sub
  127. Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
  128. If e.RowIndex = -1 Then : Else
  129. TextBox1.Text = DataGridView1.Rows(e.RowIndex).Cells("調料單號").Value.ToString : Button3.Enabled = True
  130. ComboBox2.Text = DataGridView1.Rows(e.RowIndex).Cells("供應商編號").Value : ComboBox3.Text = DataGridView1.Rows(e.RowIndex).Cells("發件人").Value
  131. ComboBox4.Text = DataGridView1.Rows(e.RowIndex).Cells("收件人").Value : DateTimePicker1.Value = DataGridView1.Rows(e.RowIndex).Cells("日期").Value
  132. TextBox7.Text = DataGridView1.Rows(e.RowIndex).Cells("制表人").Value : ComboBox7.Text = DataGridView1.Rows(e.RowIndex).Cells("客戶").Value
  133. ComboBox5.Text = DataGridView1.Rows(e.RowIndex).Cells("SHOW年").Value : ComboBox6.Text = DataGridView1.Rows(e.RowIndex).Cells("SHOW月").Value
  134. TextBox14.Text = DataGridView1.Rows(e.RowIndex).Cells("核准簽名").Value : TextBox13.Text = DataGridView1.Rows(e.RowIndex).Cells("驗證碼").Value
  135. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  136. SQL1 = "SELECT 簽名檔圖片 FROM 簽名檔管理 WHERE 圖片流水號 LIKE N'" & TextBox14.Text & "'"
  137. cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
  138. While dr.Read() = True
  139. Dim bytes As Byte() = New Byte(-1) {}
  140. bytes = DirectCast(dr.Item("簽名檔圖片"), Byte())
  141. Dim oStream As New MemoryStream(bytes)
  142. PictureBox1.Image = Bitmap.FromStream(oStream)
  143. End While
  144. conn.Close()
  145. PictureBox1.SizeMode = 4
  146. Set_使用者清單()
  147. End If
  148. End Sub
  149. Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
  150. ComboBox2.SelectedIndex = ComboBox1.SelectedIndex
  151. End Sub
  152. Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox2.SelectedIndexChanged
  153. ComboBox1.SelectedIndex = ComboBox2.SelectedIndex
  154. conn.Close()
  155. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  156. SQL1 = "SELECT 公司名, 公司電話1, 聯繫人1 FROM 供應商清單 WHERE (供應商編碼 LIKE '" & ComboBox2.Text & "') ORDER BY 廠商"
  157. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
  158. If dr.Read() Then : TextBox2.Text = dr("公司名") : TextBox3.Text = dr("聯繫人1") : TextBox4.Text = dr("公司電話1") : End If
  159. conn.Close()
  160. End Sub
  161. Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
  162. xlApp = CType(CreateObject("Excel.Application"), Application)
  163. xlBook = xlApp.Workbooks.Add
  164. xlApp.DisplayAlerts = True
  165. xlBook.Activate()
  166. xlSheet = NewMethod(xlBook)
  167. xlSheet.Activate()
  168. xlApp.Visible = True
  169. xlApp.Application.WindowState = xlMaximized
  170. xlSheet.Cells(1, 1) = "森康鞋業有限公司
  171. SenKang Footwear Ltd."
  172. xlSheet.Cells(3, 1) = "廣東東莞市厚街鎮湖景大道南150米 TEL:0769-38851258 FAX:0769-38851259" : xlSheet.Cells(6, 1) = "MATERIALS REQUEST FORM" : xlSheet.Cells(7, 1) = " 物料调料单"
  173. xlSheet.Cells(8, 1) = "Purchase NO#" : xlSheet.Cells(8, 3) = TextBox1.Text : xlSheet.Cells(10, 1) = "TO:" : xlSheet.Cells(10, 2) = TextBox2.Text
  174. xlSheet.Cells(11, 1) = "ATTN:" : xlSheet.Cells(11, 2) = TextBox3.Text : xlSheet.Cells(12, 1) = "TEL:" : xlSheet.Cells(12, 2) = TextBox4.Text
  175. xlSheet.Cells(10, 10) = "DATE:" : xlSheet.Cells(10, 11) = DateTimePicker1.Value : xlSheet.Cells(11, 10) = "FROM:" : xlSheet.Cells(11, 11) = ComboBox3.Text
  176. xlSheet.Cells(12, 10) = "EXT:" : xlSheet.Cells(12, 11) = ComboBox4.Text : xlSheet.Cells(14, 1) = "PLS ALWAYS REFER TO OUR PO#请于送货单上注明我们的订单号码"
  177. 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"
  178. 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) = "项次"
  179. xlSheet.Cells(17, 2) = "名称" : xlSheet.Cells(17, 4) = "規格" : xlSheet.Cells(17, 6) = "颜色" : xlSheet.Cells(17, 7) = "单位" : xlSheet.Cells(17, 8) = "数量"
  180. xlSheet.Cells(17, 9) = "单价" : xlSheet.Cells(17, 10) = "金额" : xlSheet.Cells(17, 11) = "备注"
  181. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  182. xlSheet.Cells(i + 18, 1) = DataGridView2.Rows(i).Cells("項次").Value : xlSheet.Cells(i + 18, 2) = DataGridView2.Rows(i).Cells("名稱").Value
  183. xlSheet.Cells(i + 18, 4) = DataGridView2.Rows(i).Cells("規格").Value : xlSheet.Cells(i + 18, 6) = DataGridView2.Rows(i).Cells("顏色").Value
  184. xlSheet.Cells(i + 18, 7) = DataGridView2.Rows(i).Cells("單位").Value : xlSheet.Cells(i + 18, 8) = DataGridView2.Rows(i).Cells("數量").Value
  185. xlSheet.Cells(i + 18, 9) = DataGridView2.Rows(i).Cells("單價").Value : xlSheet.Cells(i + 18, 10) = DataGridView2.Rows(i).Cells("金額").Value
  186. xlSheet.Cells(i + 18, 11) = DataGridView2.Rows(i).Cells("備註").Value
  187. With xlApp.Selection
  188. .Font.Bold = True
  189. End With
  190. N1 = i + 18
  191. Next i
  192. 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金额(大写):"
  193. 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"
  194. xlSheet.Cells(N1 + 3, 8) = ComboBox6.Text : xlSheet.Cells(N1 + 5, 1) = "样品请寄:廣東東莞市厚街鎮湖景大道南150米森康鞋業有限公司 人名 電話 收。"
  195. xlSheet.Cells(N1 + 7, 1) = "IMPORTANT: **请回复交期并提供物料报价" : xlSheet.Cells(N1 + 11, 3) = "驗證碼" : xlSheet.Cells(N1 + 11, 4) = TextBox13.Text : xlSheet.Cells(N1 + 12, 3) = "核准:"
  196. xlSheet.Cells(N1 + 12, 10) = "制表人:" : xlSheet.Cells(N1 + 12, 11) = TextBox7.Text
  197. AA(xlApp, xlSheet) : BB(xlApp, xlSheet)
  198. xlSheet.PageSetup.PrintArea = ""
  199. xlApp.Cells.Select()
  200. xlSheet.Range("B1").Select()
  201. xlApp.Application.WindowState = xlMinimized
  202. xlApp.ActiveSheet.Protect(DrawingObjects:=True, Contents:=True, Scenarios:=True, Password:="0911274990")
  203. xlApp.ActiveSheet.EnableSelection = 1
  204. MsgBox("列印完成")
  205. End Sub
  206. Private Shared Function NewMethod(xlBook As Workbook) As Worksheet
  207. Return CType(xlBook.Worksheets.Add, Worksheet)
  208. End Function
  209. Private Sub AA(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  210. xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 5.86 : xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 8
  211. xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 30 : xlSheet.Columns("D:E").Select : myExcel.Selection.ColumnWidth = 10
  212. xlSheet.Columns("F:F").Select : myExcel.Selection.ColumnWidth = 20 : xlSheet.Columns("G:G").Select : myExcel.Selection.ColumnWidth = 6.47
  213. xlSheet.Columns("H:H").Select : myExcel.Selection.ColumnWidth = 10 : xlSheet.Columns("I:I").Select : myExcel.Selection.ColumnWidth = 12
  214. xlSheet.Columns("J:J").Select : myExcel.Selection.ColumnWidth = 12 : xlSheet.Columns("K:K").Select : myExcel.Selection.ColumnWidth = 25.14
  215. xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 86 : xlSheet.Rows("2:2").Select : myExcel.Selection.RowHeight = 8.25
  216. xlSheet.Rows("4:5").Select : myExcel.Selection.RowHeight = 8.25 : xlSheet.Rows("9:9").Select : myExcel.Selection.RowHeight = 8.25
  217. xlSheet.Rows("13:13").Select : myExcel.Selection.RowHeight = 8.25 : xlSheet.Rows("14:14").Select : myExcel.Selection.RowHeight = 25
  218. xlSheet.Rows("15:15").Select : myExcel.Selection.RowHeight = 8.25
  219. xlSheet.Range("A1:K1").Select() : myExcel.Selection.Merge
  220. With myExcel.Selection.Font : .Name = "新細明體" : .Size = 28 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  221. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontMinor : End With
  222. xlSheet.Range("A3:K3").Select() : myExcel.Selection.Merge : myExcel.Selection.Font.Bold = True
  223. xlSheet.Range("A6:K6").Select() : myExcel.Selection.Merge : myExcel.Selection.Font.Bold = True
  224. xlSheet.Range("A7:K7").Select() : myExcel.Selection.Merge : myExcel.Selection.Font.Bold = True
  225. xlSheet.Range("B10:I10").Select() : myExcel.Selection.Merge
  226. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  227. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  228. xlSheet.Range("B11:I11").Select() : myExcel.Selection.Merge
  229. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  230. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  231. xlSheet.Range("B12:I12").Select() : myExcel.Selection.Merge
  232. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  233. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  234. xlSheet.Range("K10").Select()
  235. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  236. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  237. xlSheet.Rows("14:14").Select : myExcel.Selection.Font.Bold = True
  238. xlSheet.Range("B16:C16").Select() : myExcel.Selection.Merge : xlSheet.Range("D16:E16").Select() : myExcel.Selection.Merge
  239. xlSheet.Range("B17:C17").Select() : myExcel.Selection.Merge : xlSheet.Range("D17:E17").Select() : myExcel.Selection.Merge
  240. xlSheet.Range("A16:K17").Select() : myExcel.Selection.Font.Bold = True
  241. xlSheet.Rows("8:8").Select : myExcel.Selection.Font.Bold = True
  242. 位置1 = "18:" & N1 : xlSheet.Range(位置1).Select() : myExcel.Selection.RowHeight = 35.25
  243. 位置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
  244. 位置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
  245. 位置1 = N1 + 8 & ":" & N1 + 10 : xlSheet.Range(位置1).Select() : myExcel.Selection.RowHeight = 8.5
  246. For i As Integer = 18 To N1
  247. xlSheet.Range("B" & i & ":C" & i & "").Select() : myExcel.Selection.Merge : xlSheet.Range("D" & i & ":E" & i & "").Select() : myExcel.Selection.Merge
  248. xlSheet.Range("H" & i & ":J" & i & "").Select() : myExcel.Selection.Style = "Comma"
  249. Next i
  250. xlSheet.Rows("18:" & N1 + 2).Select
  251. With myExcel.Selection.Font : .Name = "新細明體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  252. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontMinor : End With
  253. xlSheet.Range("C" & N1 + 3).Select()
  254. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  255. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  256. xlSheet.Range("D" & N1 + 3 & ":F" & N1 + 3).Select() : myExcel.Selection.Merge
  257. xlSheet.Range("A" & N1 + 5 & ":K" & N1 + 5).Select() : myExcel.Selection.Merge
  258. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  259. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  260. xlSheet.Range("A16:K" & N1).Select()
  261. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  262. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  263. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  264. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  265. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  266. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  267. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  268. xlSheet.Range("A4:K4").Select()
  269. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  270. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  271. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  272. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  273. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  274. xlSheet.Range("A9:K9").Select()
  275. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  276. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  277. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  278. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  279. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  280. xlSheet.Range("A12:K12").Select()
  281. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  282. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  283. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  284. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  285. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  286. xlSheet.Range("D" & N1 + 2 & ":G" & N1 + 2).Select() : myExcel.Selection.Merge
  287. xlSheet.Range("H" & N1 + 2 & ":J" & N1 + 2).Select() : myExcel.Selection.Merge
  288. xlSheet.Range("H" & N1 + 2 & ":J" & N1 + 2).Select() : myExcel.Selection.NumberFormatLocal = "[DBNum2][$-zh-CN]G/通用格式"
  289. myExcel.ActiveWindow.Zoom = 80 : myExcel.ActiveWindow.DisplayGridlines = False
  290. xlSheet.Range("C" & N1 + 11).Select()
  291. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  292. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  293. xlSheet.Range("C" & N1 + 12).Select()
  294. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  295. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  296. xlSheet.Range("A" & N1 + 5 & ":K" & N1 + 5).Select()
  297. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  298. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  299. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  300. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  301. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  302. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  303. xlSheet.Range("A7:K7").Select()
  304. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  305. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  306. xlSheet.Range("A6:K6").Select()
  307. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  308. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  309. xlSheet.Range("A3:K3").Select()
  310. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  311. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  312. xlSheet.Range("A1:K1").Select()
  313. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  314. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  315. xlSheet.Range("N12").Select()
  316. xlSheet.Range("B18:C" & N1).Select()
  317. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  318. .ShrinkToFit = False : .ReadingOrder = xlContext : End With
  319. xlSheet.Range("D18:F" & N1).Select()
  320. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  321. .ShrinkToFit = False : .ReadingOrder = xlContext : End With
  322. End Sub
  323. Private Sub BB(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  324. Clipboard.SetDataObject(PictureBox1.Image)
  325. 位置1 = "D" & N1 + 12
  326. Thread.Sleep(100) '延迟0.1秒
  327. xlSheet.Range(位置1).Select()
  328. myExcel.ActiveSheet.Paste
  329. myExcel.Selection.ShapeRange.Height = 43
  330. End Sub
  331. End Class