Bez popisu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

樣品採購單歷史檔案.vb 67KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717
  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. Public Class 樣品採購單歷史檔案
  13. ReadOnly ds8 As New DataSet
  14. Dim xlApp As Application : Dim xlBook As Workbook : Dim xlSheet As Worksheet
  15. Dim N1 As Integer : DIM 對話框(0) As String
  16. ReadOnly QRCODE As DotNetBarcode = New DotNetBarcode : Dim NUM1 As Integer : Dim 新項次 As String
  17. Private Sub Set_明細清單()
  18. Dim ds As New DataSet : 明細_dgv.DataSource = Nothing : ds.Clear()
  19. 明細_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  20. 明細_dgv.ColumnHeadersHeight = 40
  21. 明細_dgv.AllowUserToAddRows = False
  22. If 小間距1_ch.Checked = False And 中間距1_ch.Checked = False And 大間距1_ch.Checked = True Then
  23. 明細_dgv.RowTemplate.Height = 75
  24. ElseIf 小間距1_ch.Checked = False And 中間距1_ch.Checked = True And 大間距1_ch.Checked = False Then
  25. 明細_dgv.RowTemplate.Height = 45
  26. ElseIf 小間距1_ch.Checked = True And 中間距1_ch.Checked = False And 大間距1_ch.Checked = False Then
  27. 明細_dgv.RowTemplate.Height = 25
  28. End If
  29. SQL_行政物料採購單一覽表_明細()
  30. da.Fill(ds) : 明細_dgv.DataSource = ds.Tables(0) : conn.Close()
  31. 明細_dgv.Columns(0).Visible = False : 明細_dgv.Columns(1).FillWeight = 80 : 明細_dgv.Columns(2).FillWeight = 250 : 明細_dgv.Columns(3).FillWeight = 250
  32. 明細_dgv.Columns(4).FillWeight = 245 : 明細_dgv.Columns(5).FillWeight = 80 : 明細_dgv.Columns(6).FillWeight = 80 : 明細_dgv.Columns(7).FillWeight = 80
  33. 明細_dgv.Columns(8).FillWeight = 80 : 明細_dgv.Columns(9).Visible = False
  34. 明細_dgv.Columns(5).DefaultCellStyle.Format = "#,##0" : 明細_dgv.Columns(7).DefaultCellStyle.Format = "#,##0" : 明細_dgv.Columns(8).DefaultCellStyle.Format = "#,##0"
  35. 明細_dgv.Columns(7).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : 明細_dgv.Columns(5).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
  36. 明細_dgv.Columns(8).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
  37. 明細_dgv.Columns(7).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter : 明細_dgv.Columns(5).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  38. 明細_dgv.Columns(8).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  39. 明細_dgv.EditMode = DataGridViewEditMode.EditOnEnter
  40. 新項次 = "00"
  41. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  42. NUM1 = Double.Parse(新項次) + 1
  43. If NUM1 < 10 Then : 新項次 = "0" & NUM1
  44. ElseIf NUM1 > 9 And NUM1 < 100 Then : 新項次 = NUM1
  45. End If
  46. 明細_dgv.Rows(i).Cells(表頭(11)).Value = 新項次
  47. Next i
  48. 總金額計算()
  49. End Sub
  50. Private Sub Set_清單1()
  51. Dim ds1 As New DataSet : 已核准_dgv.DataSource = Nothing : ds1.Clear()
  52. 已核准_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  53. 已核准_dgv.ColumnHeadersHeight = 25
  54. 已核准_dgv.AllowUserToAddRows = False
  55. SQL_行政物料採購單一覽表_已核准()
  56. da.Fill(ds1) : 已核准_dgv.DataSource = ds1.Tables(0) : conn.Close()
  57. 已核准_dgv.Columns(0).FillWeight = 125 : 已核准_dgv.Columns(1).Visible = False : 已核准_dgv.Columns(2).Visible = False : 已核准_dgv.Columns(3).Visible = False
  58. 已核准_dgv.Columns(4).Visible = False : 已核准_dgv.Columns(5).Visible = False : 已核准_dgv.Columns(6).Visible = False : 已核准_dgv.Columns(7).Visible = False
  59. 已核准_dgv.Columns(8).Visible = False : 已核准_dgv.Columns(9).Visible = False : 已核准_dgv.Columns(10).Visible = False : 已核准_dgv.Columns(11).Visible = False
  60. 已核准_dgv.Columns(12).Visible = False : 已核准_dgv.Columns(13).Visible = False : 已核准_dgv.Columns(14).Visible = False : 已核准_dgv.Columns(15).Visible = False
  61. 已核准_dgv.Columns(16).Visible = False
  62. End Sub
  63. Private Sub Set_清單2()
  64. Dim ds2 As New DataSet : 已作廢_dgv.DataSource = Nothing : ds2.Clear()
  65. 已作廢_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  66. 已作廢_dgv.ColumnHeadersHeight = 25
  67. 已作廢_dgv.AllowUserToAddRows = False
  68. SQL_行政物料採購單一覽表_已作廢()
  69. da.Fill(ds2) : 已作廢_dgv.DataSource = ds2.Tables(0) : conn.Close()
  70. 已作廢_dgv.Columns(0).FillWeight = 125 : 已作廢_dgv.Columns(1).Visible = False : 已作廢_dgv.Columns(2).Visible = False : 已作廢_dgv.Columns(3).Visible = False
  71. 已作廢_dgv.Columns(4).Visible = False : 已作廢_dgv.Columns(5).Visible = False : 已作廢_dgv.Columns(6).Visible = False : 已作廢_dgv.Columns(7).Visible = False
  72. 已作廢_dgv.Columns(8).Visible = False : 已作廢_dgv.Columns(9).Visible = False : 已作廢_dgv.Columns(10).Visible = False : 已作廢_dgv.Columns(11).Visible = False
  73. 已作廢_dgv.Columns(12).Visible = False : 已作廢_dgv.Columns(13).Visible = False : 已作廢_dgv.Columns(14).Visible = False : 已作廢_dgv.Columns(15).Visible = False
  74. 已作廢_dgv.Columns(16).Visible = False
  75. End Sub
  76. Private Sub ComboBox2下拉表單資料載入()
  77. SQL_供應商資料表_公司名_下拉用() : 廠商_cb.Items.Clear() : While (dr.Read()) : 廠商_cb.Items.Add(dr("公司名")) : End While : conn.Close()
  78. End Sub
  79. Private Sub 總金額計算()
  80. Dim FFGG As Integer = 0
  81. 總金額_tb.Text = "0"
  82. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  83. 明細_dgv.Rows(i).Cells(表頭(27)).Value = 明細_dgv.Rows(i).Cells(表頭(26)).Value * 明細_dgv.Rows(i).Cells(表頭(15)).Value
  84. FFGG = Val(FFGG) + 明細_dgv.Rows(i).Cells(表頭(27)).Value
  85. Next i
  86. 折扣金額_tb.Text = Val(折扣比_tb.Text) * FFGG / 100
  87. If 稅金計算_ch.Checked = True Then
  88. If 折扣比_tb.Text = "0" Then
  89. 稅金金額_tb.Text = FFGG * Val(稅金比_tb.Text) / 100
  90. Else
  91. 稅金金額_tb.Text = (FFGG - 折扣金額_tb.Text) * Val(稅金比_tb.Text) / 100
  92. End If
  93. Else
  94. 稅金金額_tb.Text = "0"
  95. End If
  96. 總金額_tb.Text = FFGG - Val(折扣金額_tb.Text) + Val(稅金金額_tb.Text)
  97. 折扣金額_tb.Text = Strings.Format(Val(折扣金額_tb.Text), "#,##0") : 稅金金額_tb.Text = Strings.Format(Val(稅金金額_tb.Text), "#,##0")
  98. 總金額_tb.Text = Strings.Format(Val(總金額_tb.Text), "#,##0")
  99. End Sub
  100. Private Sub Set_語言()
  101. 語言_dgv.DataSource = Nothing : ds8.Clear()
  102. 語言_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  103. 語言_dgv.ColumnHeadersHeight = 25
  104. 語言_dgv.AllowUserToAddRows = False
  105. SQL_系統語言導入()
  106. da.Fill(ds8) : 語言_dgv.DataSource = ds8.Tables(0) : conn.Close()
  107. End Sub
  108. Private Sub 語言轉換讀取()
  109. Set_語言() : conn.Close()
  110. For i As Integer = 0 To 語言_dgv.Rows.Count - 1
  111. If 語言_dgv("控件", i).Value.ToString = "行政物料採購單一覽表" Then : Me.Text = 語言_dgv("內容", i).Value.ToString : End If
  112. If 語言_dgv("控件", i).Value.ToString = "已核准_lb" Then : 已核准_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  113. If 語言_dgv("控件", i).Value.ToString = "已作廢_lb" Then : 已作廢_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  114. If 語言_dgv("控件", i).Value.ToString = "總金額_lb" Then : 總金額_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  115. If 語言_dgv("控件", i).Value.ToString = "選擇公司_lb" Then : 選擇公司_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  116. If 語言_dgv("控件", i).Value.ToString = "確認列印_bt" Then : 確認列印_bt.Text = 語言_dgv("內容", i).Value.ToString : End If
  117. If 語言_dgv("控件", i).Value.ToString = "圖片編碼_lb" Then : 圖片編碼_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  118. If 語言_dgv("控件", i).Value.ToString = "重新整理_tsm" Then : 重新整理_tsm.Text = 語言_dgv("內容", i).Value.ToString : End If
  119. If 語言_dgv("控件", i).Value.ToString = "確認列印_tsm" Then : 確認列印_tsm.Text = 語言_dgv("內容", i).Value.ToString : End If
  120. If 語言_dgv("控件", i).Value.ToString = "驗證碼_lb" Then : 驗證碼_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  121. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_項次" Then : 表頭(11) = 語言_dgv("內容", i).Value.ToString : End If
  122. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_品名" Then : 表頭(12) = 語言_dgv("內容", i).Value.ToString : End If
  123. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_規格" Then : 表頭(13) = 語言_dgv("內容", i).Value.ToString : End If
  124. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_備註" Then : 表頭(14) = 語言_dgv("內容", i).Value.ToString : End If
  125. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_數量" Then : 表頭(15) = 語言_dgv("內容", i).Value.ToString : End If
  126. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_單位" Then : 表頭(16) = 語言_dgv("內容", i).Value.ToString : End If
  127. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_單價" Then : 表頭(26) = 語言_dgv("內容", i).Value.ToString : End If
  128. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_單號" Then : 表頭(18) = 語言_dgv("內容", i).Value.ToString : End If
  129. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_金額" Then : 表頭(27) = 語言_dgv("內容", i).Value.ToString : End If
  130. If 語言_dgv("控件", i).Value.ToString = "對話框1" Then : 對話框(0) = 語言_dgv("內容", i).Value.ToString : End If
  131. If 語言_dgv("控件", i).Value.ToString = "一級簽核_lb" Then : 一級簽核_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  132. If 語言_dgv("控件", i).Value.ToString = "二級簽核_lb" Then : 二級簽核_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  133. Next
  134. End Sub
  135. Private Sub 樣品採購單歷史檔案_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  136. Me.MdiParent = HX_PGS_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
  137. H(217) = True : 介面 = "H217" : 語言轉換讀取() : 顯示說明(999, False)
  138. 地址_tb.Enabled = False : 電話_tb.Enabled = False : 郵件_tb.Enabled = False : 採購單號_tb.Enabled = False : 傳真_tb.Enabled = False : 供應商編碼_tb.Visible = False
  139. 折扣比_tb.Enabled = False : 稅金比_tb.Enabled = False : 驗證碼_tb.Enabled = False : 圖片編碼_tb.Enabled = False : 選擇公司_cb.Enabled = False : 折扣金額_tb.Enabled = False
  140. 稅金金額_tb.Enabled = False : 總金額_tb.Enabled = False : QRCode_pb.Visible = False
  141. 核對員_tb.Visible = False : 核對日期_tb.Visible = False : 詢價員_tb.Visible = False : 尋價日期_tb.Visible = False : 驗證碼1_tb.Visible = False
  142. SQL_清單欄位查詢()
  143. If Acdr.Read() Then
  144. 小間距1_ch.Checked = Acdr("L_1_1") : 中間距1_ch.Checked = Acdr("L_2_1") : 大間距1_ch.Checked = Acdr("L_3_1")
  145. End If : Access1.Close()
  146. ComboBox2下拉表單資料載入() : Set_清單1() : Set_清單2()
  147. MyMod.清單字體大小調整()
  148. 已核准_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  149. 明細_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  150. 已作廢_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  151. End Sub
  152. Private Sub 樣品採購單歷史檔案_SizeChanged(sender As Object, e As EventArgs) Handles MyBase.SizeChanged
  153. MyMod.清單字體大小調整()
  154. 已核准_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  155. 明細_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  156. 已作廢_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  157. End Sub
  158. Private Sub 採購單詢價_Closed(sender As Object, e As EventArgs) Handles MyBase.Closed
  159. H(217) = False : MyMod.虛擬桌面開啟()
  160. End Sub
  161. Private Sub 語轉扭_bt_Click(sender As Object, e As EventArgs) Handles 語轉扭_bt.Click
  162. 介面 = "H217" : 語言轉換讀取() : Set_清單2() : Set_清單1() : Set_明細清單()
  163. End Sub
  164. Private Sub 登入閒置控制_MouseMove(sender As Object, e As EventArgs) Handles MyBase.MouseMove
  165. timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True
  166. End Sub
  167. Private Sub 登入閒置控制_KeyPress(sender As Object, e As EventArgs) Handles MyBase.KeyPress
  168. timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True
  169. End Sub
  170. Dim 已超出 As Boolean
  171. Private Sub 明細_dgv_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 明細_dgv.MouseUp
  172. 'If 明細_dgv.SelectedCells.Count = 1 Then : 通知訊息 = 明細_dgv.SelectedCells(0).ColumnIndex & " " & 明細_dgv.SelectedCells(0).RowIndex) : End If
  173. If 明細_dgv.SelectedCells.Count = 1 Then : 已超出 = False : End If
  174. If 明細_dgv.SelectedCells.Count > 0 Then
  175. If 明細_dgv.SelectedCells(0).ColumnIndex = 8 Then
  176. If 已超出 = False Then
  177. Dim x As Double = 0
  178. For i As Integer = 0 To 明細_dgv.SelectedCells.Count - 1
  179. Dim 變數 As String = "" : Dim 取變數 As String
  180. 取變數 = 明細_dgv.Rows(明細_dgv.SelectedCells.Item(i).RowIndex).Cells(明細_dgv.SelectedCells.Item(i).ColumnIndex).Value
  181. For ii As Integer = 1 To Len(取變數)
  182. If ii = 1 Then : 變數 = Strings.Left(取變數, ii) : Else : If Strings.Mid(取變數, ii, 1) <> "," Then : 變數 &= Strings.Mid(取變數, ii, 1) : End If : End If
  183. Next : x += Val(變數)
  184. Next i : HX_PGS_ERP_SYS.合計_TSSL.Text = "Total : " & Strings.Format(x, "#,##0")
  185. Else : HX_PGS_ERP_SYS.合計_TSSL.Text = "Total : " & Strings.Format(0, "#,##0")
  186. End If
  187. Else : 已超出 = True : HX_PGS_ERP_SYS.合計_TSSL.Text = "Total : " & Strings.Format(0, "#,##0")
  188. End If
  189. End If
  190. End Sub
  191. Private Sub 明細_dgv_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles 明細_dgv.CellEndEdit
  192. 總金額_tb.Text = "0"
  193. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  194. 明細_dgv.Rows(i).Cells(表頭(27)).Value = 明細_dgv.Rows(i).Cells(表頭(26)).Value * 明細_dgv.Rows(i).Cells(表頭(15)).Value
  195. 總金額_tb.Text = Val(總金額_tb.Text) + 明細_dgv.Rows(i).Cells(表頭(27)).Value
  196. Next i
  197. 總金額_tb.Text = Strings.Format(Val(總金額_tb.Text), "#,##0")
  198. End Sub
  199. Private Sub 已核准_dgv_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles 已核准_dgv.CellClick
  200. If e.RowIndex = -1 Then : Else
  201. 採購單號_tb.Text = 已核准_dgv(0, e.RowIndex).Value.ToString : 折扣比_tb.Text = 已核准_dgv(13, e.RowIndex).Value.ToString : 稅金計算_ch.Checked = 已核准_dgv(14, e.RowIndex).Value
  202. 稅金比_tb.Text = 已核准_dgv(15, e.RowIndex).Value.ToString : 核對員_tb.Text = 已核准_dgv(4, e.RowIndex).Value.ToString : 核對日期_tb.Text = 已核准_dgv(5, e.RowIndex).Value.ToString
  203. 詢價員_tb.Text = 已核准_dgv(6, e.RowIndex).Value.ToString : 尋價日期_tb.Text = 已核准_dgv(7, e.RowIndex).Value.ToString : 驗證碼1_tb.Text = 已核准_dgv(11, e.RowIndex).Value.ToString
  204. If Strings.Left(採購單號_tb.Text, 3) = "HXI" Then
  205. 選擇公司_cb.Text = "PT HONG XHE INDUSTRIAL"
  206. ElseIf Strings.Left(採購單號_tb.Text, 3) = "PGS" Then
  207. 選擇公司_cb.Text = "PT PUNCAK GEMILANG SEMESTA" : End If
  208. 供應商編碼_tb.Text = 已核准_dgv(1, e.RowIndex).Value.ToString : conn.Close() : PA1 = 供應商編碼_tb.Text
  209. SQL_行政物料採購單生成_供應商資料一()
  210. If dr.Read() Then : 廠商_cb.Text = dr("公司名") : conn.Close() : End If : conn.Close()
  211. 驗證碼_tb.Text = 已核准_dgv(11, e.RowIndex).Value.ToString : 圖片編碼_tb.Text = 已核准_dgv(10, e.RowIndex).Value.ToString
  212. 使用地點_tb.Text = 已核准_dgv(3, e.RowIndex).Value.ToString : 需求日期_dtp.Value = 已核准_dgv(2, e.RowIndex).Value
  213. PA1 = 已核准_dgv("一級核准簽名檔編號", e.RowIndex).Value.ToString : SQL_主管簽名檔管理_圖片流水號()
  214. 簽名檔1_pb.Image = Nothing
  215. While dr.Read() = True
  216. Dim unused As Byte() = New Byte(-1) {}
  217. Dim bytes As Byte() = DirectCast(dr.Item("簽名檔圖片"), Byte())
  218. Dim oStream As New MemoryStream(bytes)
  219. 簽名檔1_pb.Image = Bitmap.FromStream(oStream)
  220. End While
  221. conn.Close() : 簽名檔1_pb.SizeMode = 4
  222. Set_明細清單()
  223. QRCode_pb.Image = Nothing : QRCode2_pb.Image = Nothing
  224. QRCode_pb.Image = New Bitmap(QRCode_pb.Width, QRCode_pb.Height)
  225. QRCode2_pb.Image = New Bitmap(QRCode2_pb.Width, QRCode2_pb.Height)
  226. Dim GP As Graphics = Graphics.FromImage(QRCode_pb.Image)
  227. Dim GP2 As Graphics = Graphics.FromImage(QRCode2_pb.Image)
  228. QRCODE.Type = DotNetBarcode.Types.QRCode : QRCODE.QRQuitZone = 0 : QRCODE.QRWriteBar(驗證碼1_tb.Text, 0, 0, 14, GP)
  229. QRCODE.Type = DotNetBarcode.Types.QRCode : QRCODE.QRQuitZone = 0 : QRCODE.QRWriteBar(驗證碼1_tb.Text, 0, 0, 3.5, GP2)
  230. QRCode_pb.SizeMode = 4 : QRCode2_pb.SizeMode = 4
  231. End If
  232. End Sub
  233. Private Sub 已作廢_dgv_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles 已作廢_dgv.CellClick
  234. If e.RowIndex = -1 Then : Else
  235. 採購單號_tb.Text = 已作廢_dgv(0, e.RowIndex).Value.ToString : 折扣比_tb.Text = 已作廢_dgv(13, e.RowIndex).Value.ToString : 稅金計算_ch.Checked = 已作廢_dgv(14, e.RowIndex).Value
  236. 稅金比_tb.Text = 已作廢_dgv(15, e.RowIndex).Value.ToString : 核對員_tb.Text = 已作廢_dgv(4, e.RowIndex).Value.ToString : 核對日期_tb.Text = 已作廢_dgv(5, e.RowIndex).Value.ToString
  237. 詢價員_tb.Text = 已作廢_dgv(6, e.RowIndex).Value.ToString : 尋價日期_tb.Text = 已作廢_dgv(7, e.RowIndex).Value.ToString
  238. If Strings.Left(採購單號_tb.Text, 3) = "HXI" Then
  239. 選擇公司_cb.Text = "PT HONG XHE INDUSTRIAL"
  240. ElseIf Strings.Left(採購單號_tb.Text, 3) = "PGS" Then
  241. 選擇公司_cb.Text = "PT PUNCAK GEMILANG SEMESTA" : End If
  242. 簽名檔1_pb.Image = Nothing
  243. 供應商編碼_tb.Text = 已作廢_dgv(1, e.RowIndex).Value.ToString : conn.Close() : PA1 = 供應商編碼_tb.Text
  244. SQL_行政物料採購單生成_供應商資料一()
  245. If dr.Read() Then : 廠商_cb.Text = dr("公司名") : conn.Close() : End If : conn.Close()
  246. 驗證碼_tb.Text = 已作廢_dgv(11, e.RowIndex).Value.ToString : 圖片編碼_tb.Text = 已作廢_dgv(10, e.RowIndex).Value.ToString
  247. 使用地點_tb.Text = 已作廢_dgv(3, e.RowIndex).Value.ToString : 需求日期_dtp.Value = 已作廢_dgv(2, e.RowIndex).Value
  248. Set_明細清單()
  249. End If
  250. End Sub
  251. Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 廠商_cb.SelectedIndexChanged
  252. PA1 = 廠商_cb.Text : SQL_行政物料採購單生成_供應商資料二()
  253. If dr.Read() Then
  254. 供應商編碼_tb.Text = dr("供應商編碼") : 地址_tb.Text = dr("公司地址") : 電話_tb.Text = dr("公司電話1") : 郵件_tb.Text = dr("聯繫人1郵箱") : 傳真_tb.Text = dr("公司傳真1")
  255. End If
  256. conn.Close()
  257. End Sub
  258. Private Sub 圖片編碼_tb_TextChanged(sender As Object, e As EventArgs) Handles 圖片編碼_tb.TextChanged
  259. PA1 = 圖片編碼_tb.Text : SQL_主管簽名檔管理_圖片流水號()
  260. 簽名檔2_pb.Image = Nothing
  261. While dr.Read() = True
  262. Dim unused As Byte() = New Byte(-1) {}
  263. Dim bytes As Byte() = DirectCast(dr.Item("簽名檔圖片"), Byte())
  264. Dim oStream As New MemoryStream(bytes)
  265. 簽名檔2_pb.Image = Bitmap.FromStream(oStream)
  266. End While
  267. conn.Close() : 簽名檔2_pb.SizeMode = 4
  268. End Sub
  269. Private Sub 小間距1_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 小間距1_ch.Click
  270. 小間距1_ch.Checked = True : 中間距1_ch.Checked = False : 大間距1_ch.Checked = False : MyMod.間距設定存檔_1() : Set_明細清單()
  271. End Sub
  272. Private Sub 中間距1_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 中間距1_ch.Click
  273. 小間距1_ch.Checked = False : 中間距1_ch.Checked = True : 大間距1_ch.Checked = False : MyMod.間距設定存檔_2() : Set_明細清單()
  274. End Sub
  275. Private Sub 大間距1_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 大間距1_ch.Click
  276. 小間距1_ch.Checked = False : 中間距1_ch.Checked = False : 大間距1_ch.Checked = True : MyMod.間距設定存檔_3() : Set_明細清單()
  277. End Sub
  278. Private Sub Button2_Click(sender As Object, e As EventArgs) Handles 確認列印_bt.Click
  279. xlApp = CType(CreateObject("Excel.Application"), Application)
  280. xlBook = xlApp.Workbooks.Add
  281. xlApp.DisplayAlerts = True
  282. xlBook.Activate()
  283. xlSheet = NewMethod(xlBook)
  284. xlSheet.Activate()
  285. xlApp.Visible = True
  286. xlApp.Application.WindowState = xlMaximized
  287. xlSheet.Cells(2, 1) = 選擇公司_cb.Text : xlSheet.Cells(3, 1) = "PURCHASE ORDER"
  288. xlSheet.Cells(5, 1) = "ORDER TO : " & 廠商_cb.Text : xlSheet.Cells(6, 1) = "ALAMAT : " & 地址_tb.Text : xlSheet.Cells(7, 1) = "Telp : " & 電話_tb.Text
  289. xlSheet.Cells(8, 1) = "Fax : " & 傳真_tb.Text : xlSheet.Cells(9, 1) = "Email : " & 郵件_tb.Text
  290. xlSheet.Cells(10, 1) = "No." : xlSheet.Cells(10, 2) = "Nama produk" : xlSheet.Cells(10, 3) = "Spesifikasi" : xlSheet.Cells(10, 4) = "Komentar" : xlSheet.Cells(10, 5) = "SATUAN"
  291. xlSheet.Cells(10, 6) = "QTY" : xlSheet.Cells(10, 7) = "UNIT PRICE" : xlSheet.Cells(10, 8) = "TOTAL PRICE"
  292. xlSheet.Cells(7, 5) = "PO NOMOR : " : xlSheet.Cells(7, 7) = 採購單號_tb.Text
  293. xlSheet.Cells(8, 5) = "TGL/BLN/THN : " : xlSheet.Cells(8, 7) = 需求日期_dtp.Value
  294. xlSheet.Cells(9, 5) = "TEMPAT PEMAKAIAN : " : xlSheet.Cells(9, 7) = 使用地點_tb.Text
  295. Dim GGHH As Integer = 0
  296. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  297. xlSheet.Cells(i + 11, 1) = 明細_dgv.Rows(i).Cells(表頭(11)).Value : xlSheet.Cells(i + 11, 2) = 明細_dgv.Rows(i).Cells(表頭(12)).Value
  298. xlSheet.Cells(i + 11, 3) = 明細_dgv.Rows(i).Cells(表頭(13)).Value : xlSheet.Cells(i + 11, 4) = 明細_dgv.Rows(i).Cells(表頭(14)).Value
  299. xlSheet.Cells(i + 11, 5) = 明細_dgv.Rows(i).Cells(表頭(16)).Value : xlSheet.Cells(i + 11, 6) = 明細_dgv.Rows(i).Cells(表頭(15)).Value
  300. xlSheet.Cells(i + 11, 7) = 明細_dgv.Rows(i).Cells(表頭(26)).Value : xlSheet.Cells(i + 11, 8) = 明細_dgv.Rows(i).Cells(表頭(27)).Value
  301. GGHH += 明細_dgv.Rows(i).Cells(表頭(27)).Value
  302. N1 = i + 11
  303. Next i
  304. xlSheet.Cells(N1 + 2, 7) = "TOTAL :" : xlSheet.Cells(N1 + 2, 8) = GGHH
  305. xlSheet.Cells(N1 + 3, 7) = "DISC " & 折扣比_tb.Text & "% :" : xlSheet.Cells(N1 + 3, 8) = 折扣金額_tb.Text
  306. xlSheet.Cells(N1 + 4, 7) = "PPN " & 稅金比_tb.Text & "% :" : xlSheet.Cells(N1 + 4, 8) = 稅金金額_tb.Text
  307. xlSheet.Cells(N1 + 5, 7) = "GRAND TOTAL :" : xlSheet.Cells(N1 + 5, 8) = 總金額_tb.Text
  308. xlSheet.Cells(N1 + 6, 1) = "Bagian Pembelian Barang"
  309. xlSheet.Cells(N1 + 6, 3) = "Direktur Utama"
  310. xlSheet.Cells(N1 + 6, 5) = "Bagian Pemeriksa"
  311. xlSheet.Cells(N1 + 6, 7) = "Bagian Pengisian Harga" : xlSheet.Cells(N1 + 8, 7) = 詢價員_tb.Text : xlSheet.Cells(N1 + 9, 7) = 尋價日期_tb.Text
  312. xlSheet.Cells(N1 + 6, 8) = "Asisten Proyek" : xlSheet.Cells(N1 + 8, 8) = 核對員_tb.Text : xlSheet.Cells(N1 + 9, 8) = 核對日期_tb.Text
  313. AA(xlApp, xlSheet) : EE(xlApp, xlSheet) : DD(xlApp, xlSheet) : CC(xlApp, xlSheet)
  314. xlSheet.PageSetup.PrintArea = ""
  315. xlApp.Cells.Select()
  316. xlSheet.Range("B1").Select()
  317. xlApp.Application.WindowState = xlMinimized
  318. xlSheet.Cells.Select()
  319. xlApp.ActiveSheet.Protect(DrawingObjects:=True, Contents:=True, Scenarios:=True, Password:="0911274990")
  320. xlApp.ActiveSheet.EnableSelection = 1
  321. MGB(對話框(0), 1)
  322. End Sub
  323. Private Shared Function NewMethod(xlBook As Workbook) As Worksheet
  324. Return CType(xlBook.Worksheets.Add, Worksheet)
  325. End Function
  326. Private Sub AA(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  327. xlSheet.Cells.Select()
  328. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 12 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  329. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  330. xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 6 : xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 24
  331. xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 30 : xlSheet.Columns("D:D").Select : myExcel.Selection.ColumnWidth = 20
  332. xlSheet.Columns("E:E").Select : myExcel.Selection.ColumnWidth = 10 : xlSheet.Columns("F:F").Select : myExcel.Selection.ColumnWidth = 15
  333. xlSheet.Columns("G:G").Select : myExcel.Selection.ColumnWidth = 15 : xlSheet.Columns("H:H").Select : myExcel.Selection.ColumnWidth = 30
  334. xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 5 : xlSheet.Rows("2:2").Select : myExcel.Selection.RowHeight = 35
  335. xlSheet.Rows("3:3").Select : myExcel.Selection.RowHeight = 25 : xlSheet.Rows("4:4").Select : myExcel.Selection.RowHeight = 5
  336. xlSheet.Rows("5:9").Select : myExcel.Selection.RowHeight = 20 : xlSheet.Rows("10:10").Select : myExcel.Selection.RowHeight = 20
  337. xlSheet.Rows("11:" & N1).Select : myExcel.Selection.RowHeight = 65 : xlSheet.Rows(N1 + 1 & ":" & N1 + 1).Select : myExcel.Selection.RowHeight = 5
  338. xlSheet.Rows(N1 + 2 & ":" & N1 + 5).Select : myExcel.Selection.RowHeight = 17 : xlSheet.Rows(N1 + 6 & ":" & N1 + 6).Select : myExcel.Selection.RowHeight = 35
  339. xlSheet.Rows(N1 + 7 & ":" & N1 + 9).Select : myExcel.Selection.RowHeight = 35
  340. xlSheet.Range("A2:H2").Select()
  341. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  342. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  343. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 26 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  344. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  345. xlSheet.Range("A3:H3").Select()
  346. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  347. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  348. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 16 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  349. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  350. xlSheet.Range("A10:H" & N1).Select()
  351. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  352. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  353. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  354. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  355. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  356. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  357. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  358. xlSheet.Range("A" & N1 + 2 & ":H" & N1 + 2).Select()
  359. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  360. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  361. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  362. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  363. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  364. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  365. xlSheet.Range("A" & N1 + 3 & ":H" & N1 + 3).Select()
  366. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  367. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  368. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  369. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  370. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  371. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  372. xlSheet.Range("A" & N1 + 4 & ":H" & N1 + 4).Select()
  373. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  374. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  375. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  376. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  377. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  378. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  379. xlSheet.Range("A" & N1 + 5 & ":H" & N1 + 5).Select()
  380. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  381. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  382. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  383. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  384. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  385. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  386. xlSheet.Range("A" & N1 + 6 & ":B" & N1 + 6).Select()
  387. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  388. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  389. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  390. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  391. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  392. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  393. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  394. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  395. xlSheet.Range("C" & N1 + 6 & ":C" & N1 + 6).Select()
  396. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  397. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  398. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  399. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  400. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  401. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  402. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  403. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  404. xlSheet.Range("D" & N1 + 6 & ":E" & N1 + 6).Select()
  405. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  406. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  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. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  413. xlSheet.Range("F" & N1 + 6 & ":G" & N1 + 6).Select()
  414. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  415. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  416. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  417. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  418. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  419. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  420. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  421. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  422. xlSheet.Range("H" & N1 + 6).Select()
  423. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  424. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  425. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  426. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  427. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  428. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  429. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  430. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  431. xlSheet.Range("A" & N1 + 7 & ":B" & N1 + 9).Select()
  432. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  433. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  434. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  435. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  436. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  437. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  438. xlSheet.Range("C" & N1 + 7 & ":C" & N1 + 9).Select()
  439. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  440. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  441. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  442. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  443. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  444. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  445. xlSheet.Range("D" & N1 + 7 & ":E" & N1 + 9).Select()
  446. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  447. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  448. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  449. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  450. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  451. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  452. xlSheet.Range("F" & N1 + 7 & ":G" & N1 + 9).Select()
  453. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  454. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  455. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  456. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  457. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  458. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  459. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  460. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  461. xlSheet.Range("H" & N1 + 7 & ":H" & N1 + 9).Select()
  462. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  463. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  464. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  465. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  466. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  467. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  468. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  469. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  470. xlSheet.Range("A10:A" & N1).Select()
  471. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  472. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  473. xlSheet.Range("B11:D" & N1).Select()
  474. With myExcel.Selection
  475. .HorizontalAlignment = xlGeneral : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  476. .ReadingOrder = xlContext : .MergeCells = False : End With
  477. xlSheet.Range("E11:F" & N1).Select()
  478. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  479. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  480. xlSheet.Range("G11:H" & N1).Select() : myExcel.Selection.NumberFormatLocal = "#,##0"
  481. xlSheet.Range("H" & N1 + 2).Select() : myExcel.Selection.NumberFormatLocal = "#,##0"
  482. xlSheet.Range("H" & N1 + 2 & ":H" & N1 + 5).Select()
  483. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  484. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  485. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  486. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  487. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  488. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  489. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  490. myExcel.ActiveWindow.DisplayGridlines = False
  491. xlSheet.Range("A3:H3").Select()
  492. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  493. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  494. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  495. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  496. xlSheet.Range("G7:G9").Select()
  497. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  498. .ReadingOrder = xlContext : .MergeCells = False : End With
  499. xlSheet.Range("A10:H" & N1).Select()
  500. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  501. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  502. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  503. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  504. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  505. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  506. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  507. xlSheet.Range("A" & N1 + 2 & ":H" & N1 + 5).Select()
  508. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  509. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  510. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  511. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  512. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  513. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  514. xlSheet.Range("A" & N1 + 6 & ":B" & N1 + 9).Select()
  515. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  516. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  517. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  518. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  519. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  520. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  521. xlSheet.Range("C" & N1 + 6 & ":C" & N1 + 9).Select()
  522. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  523. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  524. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  525. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  526. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  527. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  528. xlSheet.Range("D" & N1 + 6 & ":E" & N1 + 9).Select()
  529. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  530. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  531. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  532. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  533. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  534. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  535. xlSheet.Range("F" & N1 + 6 & ":G" & N1 + 9).Select()
  536. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  537. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  538. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  539. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  540. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  541. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  542. xlSheet.Range("H" & N1 + 6 & ":H" & N1 + 9).Select()
  543. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  544. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  545. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  546. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  547. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  548. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  549. xlSheet.Rows("5:9").Select
  550. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  551. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  552. xlSheet.Rows("11:" & N1).Select
  553. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  554. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  555. xlSheet.Range("A10:H10").Select()
  556. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  557. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  558. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  559. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  560. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  561. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  562. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  563. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  564. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  565. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  566. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  567. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  568. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  569. xlSheet.Range("A11:H" & N1).Select()
  570. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  571. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  572. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  573. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  574. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  575. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  576. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  577. xlSheet.Range("B11:D" & N1).Select()
  578. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  579. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  580. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  581. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  582. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  583. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  584. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  585. xlSheet.Range("F11:F" & N1).Select()
  586. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  587. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  588. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  589. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  590. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  591. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  592. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  593. xlSheet.Range("H11:H" & N1).Select()
  594. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  595. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  596. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  597. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  598. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  599. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  600. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  601. xlSheet.Range("A" & N1 + 2 & ":H" & N1 + 5).Select()
  602. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  603. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  604. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  605. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  606. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  607. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  608. xlSheet.Range("H" & N1 + 2 & ":H" & N1 + 5).Select()
  609. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  610. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  611. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  612. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  613. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  614. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  615. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  616. xlSheet.Range("G" & N1 + 2 & ":G" & N1 + 5).Select()
  617. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  618. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  619. xlSheet.Range("F" & N1 + 8 & ":G" & N1 + 8).Select()
  620. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  621. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  622. xlSheet.Range("F" & N1 + 9 & ":G" & N1 + 9).Select()
  623. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  624. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  625. myExcel.Application.PrintCommunication = False
  626. With myExcel.ActiveSheet.PageSetup : .PrintTitleRows = "$1:$10" : .PrintTitleColumns = "" : End With
  627. myExcel.Application.PrintCommunication = True : myExcel.ActiveSheet.PageSetup.PrintArea = "" : myExcel.Application.PrintCommunication = False
  628. With myExcel.ActiveSheet.PageSetup : .LeftHeader = "" : .CenterHeader = "" : .RightHeader = "" : .LeftFooter = "" : .CenterFooter = "" : .RightFooter = ""
  629. .LeftMargin = myExcel.Application.InchesToPoints(0.236220472440945) : .RightMargin = myExcel.Application.InchesToPoints(0.236220472440945)
  630. .TopMargin = myExcel.Application.InchesToPoints(0.748031496062992) : .BottomMargin = myExcel.Application.InchesToPoints(0.748031496062992)
  631. .HeaderMargin = myExcel.Application.InchesToPoints(0.31496062992126) : .FooterMargin = myExcel.Application.InchesToPoints(0.31496062992126)
  632. .PrintHeadings = False : .PrintGridlines = False : .CenterHorizontally = True : .CenterVertically = False : .Draft = False : .FirstPageNumber = xlAutomatic
  633. .BlackAndWhite = False : .Zoom = 60 : .OddAndEvenPagesHeaderFooter = False : .DifferentFirstPageHeaderFooter = False : .ScaleWithDocHeaderFooter = True
  634. .AlignMarginsHeaderFooter = True : .EvenPage.LeftHeader.Text = "" : .EvenPage.CenterHeader.Text = "" : .EvenPage.RightHeader.Text = ""
  635. .EvenPage.LeftFooter.Text = "" : .EvenPage.CenterFooter.Text = "" : .EvenPage.RightFooter.Text = "" : .FirstPage.LeftHeader.Text = ""
  636. .FirstPage.CenterHeader.Text = "" : .FirstPage.RightHeader.Text = "" : .FirstPage.LeftFooter.Text = "" : .FirstPage.CenterFooter.Text = ""
  637. .FirstPage.RightFooter.Text = ""
  638. End With
  639. myExcel.Application.PrintCommunication = True
  640. End Sub
  641. Private Sub CC(ByVal myExcel As Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  642. Clipboard.SetDataObject(簽名檔2_pb.Image)
  643. xlSheet.Range("C" & N1 + 9).Select()
  644. myExcel.ActiveSheet.Pictures.Paste.Select
  645. myExcel.Selection.ShapeRange.Height = 50
  646. myExcel.Selection.ShapeRange.IncrementLeft(2)
  647. myExcel.Selection.ShapeRange.IncrementTop(-23)
  648. End Sub
  649. Private Sub DD(ByVal myExcel As Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  650. Clipboard.SetDataObject(QRCode_pb.Image)
  651. xlSheet.Range("C" & N1 + 7).Select()
  652. myExcel.ActiveSheet.Pictures.Paste.Select
  653. myExcel.Selection.ShapeRange.Height = 45
  654. myExcel.Selection.ShapeRange.IncrementLeft(60)
  655. myExcel.Selection.ShapeRange.IncrementTop(1)
  656. End Sub
  657. Private Sub EE(ByVal myExcel As Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  658. Clipboard.SetDataObject(簽名檔1_pb.Image)
  659. xlSheet.Range("D" & N1 + 9).Select()
  660. myExcel.ActiveSheet.Pictures.Paste.Select
  661. myExcel.Selection.ShapeRange.Height = 50
  662. myExcel.Selection.ShapeRange.IncrementLeft(2)
  663. myExcel.Selection.ShapeRange.IncrementTop(-23)
  664. End Sub
  665. '-----------------------------滑鼠右鍵--------------------------------------------------------------------------------------------------------------------------------------
  666. Private Sub 重新整理ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 重新整理_tsm.Click
  667. Set_清單1() : Set_清單2()
  668. End Sub
  669. Private Sub 確認列印ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 確認列印_tsm.Click
  670. Me.確認列印_bt.PerformClick()
  671. End Sub
  672. End Class