Nav apraksta
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

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

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