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 42KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. Option Strict Off
  2. Imports Microsoft.Office.Interop.Excel.XlUnderlineStyle
  3. Imports Microsoft.Office.Interop.Excel.Constants
  4. Imports Microsoft.Office.Interop.Excel.XlBordersIndex
  5. Imports Microsoft.Office.Interop.Excel.XlLineStyle
  6. Imports Microsoft.Office.Interop.Excel.XlBorderWeight
  7. Imports Microsoft.Office.Interop.Excel.XlThemeFont
  8. Imports Microsoft.Office.Interop.Excel.XlThemeColor
  9. Imports Microsoft.Office.Interop.Excel.XlWindowState
  10. Imports Microsoft.Office.Interop.Excel
  11. Public Class 附錄合約
  12. ReadOnly ds8 As New DataSet
  13. Dim 放大 As Boolean
  14. Dim ESTR As String
  15. Dim EDR As Integer = 0
  16. Dim xlApp As Application : Dim xlBook As Workbook : Dim xlSheet As Worksheet
  17. ReadOnly 對話框(7) As String
  18. Private Sub Set_合約清單()
  19. Dim ds6 As New DataSet
  20. 合約_dgv.DataSource = Nothing : ds6.Clear()
  21. 合約_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  22. 合約_dgv.ColumnHeadersHeight = 25 : 合約_dgv.AllowUserToAddRows = False
  23. PA46 = 合約編號1_cb.Text : PA47 = 工程期1_ch.Text
  24. SQL_合約清單()
  25. da.Fill(ds6) : 合約_dgv.DataSource = ds6.Tables(0) : conn.Close()
  26. 合約_dgv.Columns(0).FillWeight = 160 : 合約_dgv.Columns(1).Visible = False : 合約_dgv.Columns(2).Visible = False : 合約_dgv.Columns(3).Visible = False
  27. 合約_dgv.Columns(4).Visible = False : 合約_dgv.Columns(5).Visible = False : 合約_dgv.Columns(6).Visible = False : 合約_dgv.Columns(7).Visible = False
  28. 合約_dgv.Columns(8).Visible = False : 合約_dgv.Columns(9).Visible = False : 合約_dgv.Columns(10).Visible = False : 合約_dgv.Columns(11).Visible = False
  29. 合約_dgv.Columns(12).Visible = False : 合約_dgv.Columns(13).Visible = False : 合約_dgv.Columns(14).Visible = False : 合約_dgv.Columns(15).Visible = False
  30. 合約_dgv.Columns(16).Visible = False : 合約_dgv.Columns(17).Visible = False : 合約_dgv.Columns(18).Visible = False : 合約_dgv.Columns(19).Visible = False
  31. 合約_dgv.Columns(20).Visible = False : 合約_dgv.Columns(21).Visible = False : 合約_dgv.Columns(22).Visible = False : 合約_dgv.Columns(23).Visible = False
  32. 合約_dgv.Columns(24).FillWeight = 100 : 合約_dgv.Columns(25).Visible = False : 合約_dgv.Columns(26).Visible = False : 合約_dgv.Columns(27).Visible = False
  33. 合約_dgv.Columns(28).Visible = False : 合約_dgv.Columns("工程").FillWeight = 300 : 合約_dgv.Columns("Project").FillWeight = 300
  34. If 系統語言 = "繁體中文" Then
  35. If 放大 = True Then : 合約_dgv.Columns("工程").Visible = True : Else : 合約_dgv.Columns("工程").Visible = False : End If
  36. Else
  37. If 放大 = True Then : 合約_dgv.Columns("Project").Visible = True : Else : 合約_dgv.Columns("Project").Visible = False : End If
  38. End If
  39. End Sub
  40. Private Sub Set_附錄清單()
  41. Dim ds1 As New DataSet
  42. 合約附錄_dgv.DataSource = Nothing : ds1.Clear()
  43. 合約附錄_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  44. 合約附錄_dgv.ColumnHeadersHeight = 25 : 合約附錄_dgv.AllowUserToAddRows = False
  45. SQL_附錄合約_清單查詢()
  46. da.Fill(ds1) : 合約附錄_dgv.DataSource = ds1.Tables(0) : conn.Close()
  47. 合約附錄_dgv.Columns(0).Visible = False : 合約附錄_dgv.Columns(1).FillWeight = 160 : 合約附錄_dgv.Columns(2).Visible = False : 合約附錄_dgv.Columns(3).Visible = False
  48. 合約附錄_dgv.Columns(4).Visible = False : 合約附錄_dgv.Columns(5).Visible = False : 合約附錄_dgv.Columns(6).Visible = False : 合約附錄_dgv.Columns(7).FillWeight = 70
  49. End Sub
  50. Private Sub 甲方條件下拉清單讀取()
  51. SQL合約條件讀取() : 合約編號1_cb.Items.Clear() : 合約編號1_cb.Items.Add("") : While (dr.Read()) : 合約編號1_cb.Items.Add(dr("約號甲方")) : End While : conn.Close()
  52. End Sub
  53. Private Sub Set_語言()
  54. 語言_dgv.DataSource = Nothing : ds8.Clear()
  55. 語言_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  56. 語言_dgv.ColumnHeadersHeight = 25
  57. 語言_dgv.AllowUserToAddRows = False
  58. SQL_系統語言導入()
  59. da.Fill(ds8) : 語言_dgv.DataSource = ds8.Tables(0) : conn.Close()
  60. End Sub
  61. Private Sub 語言轉換讀取()
  62. Set_語言() : conn.Close()
  63. For i As Integer = 0 To 語言_dgv.Rows.Count - 1
  64. If 語言_dgv("控件", i).Value.ToString = "附錄合約" Then : Me.Text = 語言_dgv("內容", i).Value.ToString : End If
  65. If 語言_dgv("控件", i).Value.ToString = "甲方_lb" Then : 甲方_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  66. If 語言_dgv("控件", i).Value.ToString = "搜尋_lb" Then : 搜尋_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  67. If 語言_dgv("控件", i).Value.ToString = "新增資料_bt" Then : 新增資料_bt.Text = 語言_dgv("內容", i).Value.ToString : End If
  68. If 語言_dgv("控件", i).Value.ToString = "存檔_bt" Then : 存檔_bt.Text = 語言_dgv("內容", i).Value.ToString : End If
  69. If 語言_dgv("控件", i).Value.ToString = "列印_bt" Then : 列印_bt.Text = 語言_dgv("內容", i).Value.ToString : End If
  70. If 語言_dgv("控件", i).Value.ToString = "刪除_bt" Then : 刪除_bt.Text = 語言_dgv("內容", i).Value.ToString : End If
  71. If 語言_dgv("控件", i).Value.ToString = "不列印金額_ch" Then : 不列印金額_ch.Text = 語言_dgv("內容", i).Value.ToString : End If
  72. If 語言_dgv("控件", i).Value.ToString = "附錄編號_lb" Then : 附錄編號_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  73. If 語言_dgv("控件", i).Value.ToString = "合約編號_lb" Then : 合約編號_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  74. If 語言_dgv("控件", i).Value.ToString = "立約日期_lb" Then : 立約日期_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  75. If 語言_dgv("控件", i).Value.ToString = "工程名稱_中_lb" Then : 工程名稱_中_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  76. If 語言_dgv("控件", i).Value.ToString = "工程名稱_英_lb" Then : 工程名稱_英_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  77. If 語言_dgv("控件", i).Value.ToString = "客戶名稱_lb" Then : 客戶名稱_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  78. If 語言_dgv("控件", i).Value.ToString = "合約附錄停用_ch" Then : 合約附錄停用_ch.Text = 語言_dgv("內容", i).Value.ToString : End If
  79. If 語言_dgv("控件", i).Value.ToString = "原合约金额_lb" Then : 原合约金额_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  80. If 語言_dgv("控件", i).Value.ToString = "追加减_lb" Then : 追加减_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  81. If 語言_dgv("控件", i).Value.ToString = "總金額_lb" Then : 總金額_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  82. If 語言_dgv("控件", i).Value.ToString = "其他內容_lb" Then : 其他內容_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  83. If 語言_dgv("控件", i).Value.ToString = "dgv_合約號" Then : 表頭(134) = 語言_dgv("內容", i).Value.ToString : End If
  84. If 語言_dgv("控件", i).Value.ToString = "dgv_立約日期" Then : 表頭(116) = 語言_dgv("內容", i).Value.ToString : End If
  85. If 語言_dgv("控件", i).Value.ToString = "dgv_附錄編號" Then : 表頭(99) = 語言_dgv("內容", i).Value.ToString : End If
  86. If 語言_dgv("控件", i).Value.ToString = "dgv_保固到期" Then : 表頭(179) = 語言_dgv("內容", i).Value.ToString : End If
  87. If 語言_dgv("控件", i).Value.ToString = "對話框1" Then : 對話框(0) = 語言_dgv("內容", i).Value.ToString : End If
  88. If 語言_dgv("控件", i).Value.ToString = "對話框2" Then : 對話框(1) = 語言_dgv("內容", i).Value.ToString : End If
  89. If 語言_dgv("控件", i).Value.ToString = "對話框3" Then : 對話框(2) = 語言_dgv("內容", i).Value.ToString : End If
  90. If 語言_dgv("控件", i).Value.ToString = "對話框4" Then : 對話框(3) = 語言_dgv("內容", i).Value.ToString : End If
  91. If 語言_dgv("控件", i).Value.ToString = "對話框5" Then : 對話框(4) = 語言_dgv("內容", i).Value.ToString : End If
  92. If 語言_dgv("控件", i).Value.ToString = "對話框6" Then : 對話框(5) = 語言_dgv("內容", i).Value.ToString : End If
  93. If 語言_dgv("控件", i).Value.ToString = "對話框7" Then : 對話框(6) = 語言_dgv("內容", i).Value.ToString : End If
  94. If 語言_dgv("控件", i).Value.ToString = "對話框8" Then : 對話框(7) = 語言_dgv("內容", i).Value.ToString : End If
  95. Next
  96. End Sub
  97. Private Sub 附錄合約_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  98. H(104) = True : 介面 = "H104" : 語言轉換讀取()
  99. 甲方條件下拉清單讀取() : Set_合約清單() : Set_附錄清單() : 合約報價單_Siz()
  100. End Sub
  101. Private Sub 合約報價單_Siz()
  102. MyModule1.清單字體大小調整()
  103. 合約_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  104. 合約附錄_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  105. End Sub
  106. Private Sub 附錄合約_Closed(sender As Object, e As EventArgs) Handles MyBase.Closed
  107. H(104) = False
  108. End Sub
  109. Private Sub 語轉扭_bt_Click(sender As Object, e As EventArgs) Handles 語轉扭_bt.Click
  110. 介面 = "H104" : 語言轉換讀取() : Set_合約清單() : Set_附錄清單()
  111. End Sub
  112. Private Sub 登入閒置控制_MouseMove(sender As Object, e As EventArgs) Handles MyBase.MouseMove
  113. timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True
  114. End Sub
  115. Private Sub 登入閒置控制_KeyPress(sender As Object, e As EventArgs) Handles MyBase.KeyPress
  116. timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True
  117. End Sub
  118. Private Sub 合約_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 合約_dgv.CellClick
  119. If e.RowIndex = -1 Then : Else
  120. 客戶名稱_tb.Text = 合約_dgv("客戶名稱", e.RowIndex).Value.ToString : 合約編號_tb.Text = 合約_dgv(表頭(134), e.RowIndex).Value.ToString
  121. 工程名稱_中_tb.Text = 合約_dgv("工程", e.RowIndex).Value.ToString : 工程名稱_英_tb.Text = 合約_dgv("Project", e.RowIndex).Value.ToString
  122. NUD3.Value = 合約_dgv("工程總價", e.RowIndex).Value : NUD2.Value = 0 : 其他內容_tb.Text = ""
  123. PA = 合約編號_tb.Text : Set_附錄清單() : If 放大 = True Then : 縮放2_bt.PerformClick() : End If
  124. End If
  125. End Sub
  126. Private Sub 合約附錄_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 合約附錄_dgv.CellClick
  127. NUD3.Value = 合約附錄_dgv("原金額", e.RowIndex).Value : NUD2.Value = 合約附錄_dgv("追加減", e.RowIndex).Value
  128. 附錄編號_tb.Text = 合約附錄_dgv(表頭(99), e.RowIndex).Value.ToString : 其他內容_tb.Text = 合約附錄_dgv("其他內容", e.RowIndex).Value.ToString
  129. 合約附錄停用_ch.Checked = 合約附錄_dgv(表頭(179), e.RowIndex).Value
  130. End Sub
  131. Private Sub 合約編號1_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 合約編號1_cb.SelectedIndexChanged
  132. Set_合約清單()
  133. End Sub
  134. Private Sub 工程期1_ch_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 工程期1_ch.SelectedIndexChanged
  135. Set_合約清單()
  136. End Sub
  137. Private Sub NUD3_ValueChanged(sender As Object, e As EventArgs) Handles NUD3.ValueChanged
  138. NUD1.Value = NUD3.Value + NUD2.Value
  139. End Sub
  140. Private Sub NUD2_ValueChanged(sender As Object, e As EventArgs) Handles NUD2.ValueChanged
  141. NUD1.Value = NUD3.Value + NUD2.Value
  142. End Sub
  143. Private Sub 查詢_bt_Click(sender As Object, e As EventArgs) Handles 查詢_bt.Click
  144. PA = 關鍵字搜尋_tb.Text : Set_合約清單()
  145. End Sub
  146. Private Sub 新增資料_bt_Click(sender As Object, e As EventArgs) Handles 新增資料_bt.Click
  147. If 合約編號_tb.Text = "" Then : MsgBox(對話框(0)) : Else
  148. SQL_附錄合約_最後一筆資料()
  149. If dr.Read() Then : EDR = Double.Parse(Strings.Right(dr("附錄編號").ToString, 9)) : Else : EDR = 0 : End If
  150. conn.Close() : EDR += 1
  151. If EDR < 10 Then : ESTR = "HP" & "00000000" & EDR
  152. ElseIf EDR > 9 And EDR < 100 Then : ESTR = "HP" & "0000000" & EDR
  153. ElseIf EDR > 99 And EDR < 1000 Then : ESTR = "HP" & "000000" & EDR
  154. ElseIf EDR > 999 And EDR < 10000 Then : ESTR = "HP" & "00000" & EDR
  155. ElseIf EDR > 9999 And EDR < 100000 Then : ESTR = "HP" & "0000" & EDR
  156. ElseIf EDR > 99999 And EDR < 100000 Then : ESTR = "HP" & "000" & EDR
  157. ElseIf EDR > 999999 And EDR < 1000000 Then : ESTR = "HP" & "00" & EDR
  158. ElseIf EDR > 9999999 And EDR < 10000000 Then : ESTR = "HP" & "0" & EDR
  159. ElseIf EDR > 99999999 Then : ESTR = "HP" & EDR : End If
  160. 附錄編號_tb.Text = ESTR : NUD2.Value = 0 : 其他內容_tb.Text = ""
  161. End If
  162. End Sub
  163. Private Sub 刪除_bt_Click(sender As Object, e As EventArgs) Handles 刪除_bt.Click
  164. If 合約編號_tb.Text = "" Then : MsgBox(對話框(0)) : Else
  165. If 附錄編號_tb.Text = "" Then : MsgBox(對話框(1)) : Else
  166. PA1 = 附錄編號_tb.Text : SQL_附錄合約_刪除() : Set_附錄清單() : MsgBox(對話框(2))
  167. End If
  168. End If
  169. End Sub
  170. Private Sub 存檔_bt_Click(sender As Object, e As EventArgs) Handles 存檔_bt.Click
  171. If 合約編號_tb.Text = "" Then : MsgBox(對話框(0)) : Else
  172. If 附錄編號_tb.Text = "" Then : MsgBox(對話框(1)) : Else
  173. PA = 合約編號_tb.Text : PA1 = 附錄編號_tb.Text : PA2 = Strings.Format(立約日期_dtp.Value, "yyyy/MM/dd") : PA3 = NUD3.Value : PA4 = NUD2.Value
  174. PA5 = NUD1.Value : PA6 = 其他內容_tb.Text : BL1 = 合約附錄停用_ch.Checked
  175. SQL_附錄合約_最後一筆資料1() : If dr.Read() Then : SQL_附錄合約_修改() : Else : SQL_附錄合約_新增() : End If : Set_附錄清單() : MsgBox(對話框(3))
  176. End If
  177. End If
  178. End Sub
  179. Private Sub 縮放2_bt_Click(sender As Object, e As EventArgs) Handles 縮放2_bt.Click
  180. Dim NX, NY As Integer : NX = 合約_dgv.Size.Width : NY = 合約_dgv.Size.Height
  181. If 放大 = True Then
  182. 合約_dgv.Size = New System.Drawing.Point(NX - 400, NY) : 放大 = False
  183. If 系統語言 = "繁體中文" Then
  184. 合約_dgv.Columns("工程").Visible = False
  185. Else
  186. 合約_dgv.Columns("Project").Visible = False
  187. End If
  188. Else
  189. 合約_dgv.Size = New System.Drawing.Point(NX + 400, NY) : 放大 = True
  190. If 系統語言 = "繁體中文" Then
  191. 合約_dgv.Columns("工程").Visible = True
  192. Else
  193. 合約_dgv.Columns("Project").Visible = False
  194. End If
  195. End If
  196. End Sub
  197. Private Sub 列印_bt_Click(sender As Object, e As EventArgs) Handles 列印_bt.Click
  198. If 合約編號_tb.Text = "" Then : MsgBox(對話框(4)) : Else
  199. If 附錄編號_tb.Text = "" Then : MsgBox(對話框(5)) : Else
  200. If 合約附錄停用_ch.Checked = True Then : MsgBox(對話框(6)) : Else
  201. xlApp = CType(CreateObject("Excel.Application"), Application)
  202. xlApp.Visible = True
  203. xlApp.DisplayAlerts = True
  204. xlApp.Application.WindowState = xlMaximized
  205. xlBook = xlApp.Workbooks.Add
  206. '----------------------------------------------------------------------------------------------------------------------
  207. xlSheet = NewMethod(xlBook) : xlApp.Sheets(1).Select : xlApp.Sheets(1).Name = "合約附錄"
  208. xlBook.Activate() : xlSheet.Activate()
  209. xlSheet.Cells(2, 1) = "附錄合約" : xlSheet.Cells(3, 1) = "Appendix contract" : xlSheet.Cells(4, 1) = "編號(No) : " & 合約編號_tb.Text
  210. xlSheet.Cells(5, 1) = 工程名稱_中_tb.Text : xlSheet.Cells(6, 1) = 工程名稱_英_tb.Text
  211. xlSheet.Cells(7, 1) = "日期(Date) : " & Strings.Format(立約日期_dtp.Value, "yyyy/MM/dd")
  212. Dim BF As String
  213. If Strings.Left(合約編號_tb.Text, 2) = "HX" Then : BF = "PT HONG XHE INDUSTRIAL" : Else : BF = "PT PUNCAK GEMILANG SEMESTA"
  214. End If
  215. xlSheet.Cells(8, 1) = "根據 " & 合約編號_tb.Text & " 號合同,雙方為A方 " & 客戶名稱_tb.Text & " 和B方 " & BF
  216. xlSheet.Cells(9, 1) = "According to the contract of " & 合約編號_tb.Text & ", both parties are " & 客戶名稱_tb.Text & " of Party A and " & BF
  217. If 不列印金額_ch.Checked = False Then
  218. xlSheet.Cells(11, 1) = "雙方同意此 " & 合約編號_tb.Text & " 號合同工程款变更为:"
  219. xlSheet.Cells(12, 1) = "The parties agree that the contract amount of this " & 合約編號_tb.Text & " will be changed to: "
  220. xlSheet.Cells(13, 1) = "1、原合约金额(含税) :" & Strings.Format(NUD3.Value, "#,##0") & " RP"
  221. xlSheet.Cells(14, 1) = " Original contract amount (including tax): " & Strings.Format(NUD3.Value, "#,##0") & " RP"
  222. xlSheet.Cells(16, 1) = "2、追加/追减金额(含税) :" & Strings.Format(NUD2.Value, "#,##0") & " RP"
  223. xlSheet.Cells(17, 1) = " Additional/reduction amount (including tax): " & Strings.Format(NUD2.Value, "#,##0") & " RP"
  224. xlSheet.Cells(19, 1) = "3、结算总金額(含税) : " & Strings.Format(NUD1.Value, "#,##0") & " RP"
  225. xlSheet.Cells(20, 1) = " Total settlement amount (including tax): " & Strings.Format(NUD1.Value, "#,##0") & " RP"
  226. xlSheet.Cells(22, 1) = 其他內容_tb.Text
  227. xlSheet.Cells(24, 1) = "此份附錄合同立成02份(中,英文版),A方執01份、B方執01份,在法律上均具同時等價值。 "
  228. xlSheet.Cells(25, 1) = "This appendix has a contract of 02 copies (in Chinese and English), with A party holding 01 copies and Party B holding 01 copies, which are legally equivalent"
  229. xlSheet.Cells(27, 1) = "Party A (A方)" : xlSheet.Cells(27, 3) = "Party B (B方)"
  230. Else
  231. xlSheet.Cells(11, 1) = 其他內容_tb.Text
  232. xlSheet.Cells(13, 1) = "此份附錄合同立成02份(中,英文版),A方執01份、B方執01份,在法律上均具同時等價值。 "
  233. xlSheet.Cells(14, 1) = "This appendix has a contract of 02 copies (in Chinese and English), with A party holding 01 copies and Party B holding 01 copies, which are legally equivalent"
  234. xlSheet.Cells(16, 1) = "Party A (A方)" : xlSheet.Cells(27, 3) = "Party B (B方)"
  235. End If
  236. AA(xlApp, xlSheet)
  237. If Strings.Left(合約編號_tb.Text, 2) = "HX" Then : CC(xlApp, xlSheet) : Else : DD(xlApp, xlSheet) : End If : FF(xlApp, xlSheet)
  238. xlApp.Sheets(2).Delete
  239. xlSheet.PageSetup.PrintArea = ""
  240. xlApp.Cells.Select()
  241. xlApp.Application.WindowState = xlMinimized
  242. MsgBox(對話框(7))
  243. End If
  244. End If
  245. End If
  246. End Sub
  247. Private Shared Function NewMethod(xlBook As Workbook) As Worksheet
  248. Return CType(xlBook.Worksheets.Add, Worksheet)
  249. End Function
  250. Private Sub AA(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  251. xlSheet.Cells.Select()
  252. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 12 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  253. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  254. xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 95
  255. xlSheet.Columns("A:C").Select : myExcel.Selection.ColumnWidth = 40
  256. xlSheet.Range("A2:C2").Select()
  257. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  258. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  259. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 22 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  260. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  261. xlSheet.Range("A3:C3").Select()
  262. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  263. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  264. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 22 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  265. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  266. myExcel.Selection.Font.Underline = xlUnderlineStyleSingle
  267. xlSheet.Range("A4:C4").Select()
  268. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  269. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  270. xlSheet.Range("A5:C5").Select()
  271. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  272. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  273. xlSheet.Range("A6:C6").Select()
  274. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  275. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  276. xlSheet.Range("A7:C7").Select()
  277. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  278. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  279. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  280. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  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 = xlThin : 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("A8:C8").Select()
  287. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  288. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  289. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  290. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  291. xlSheet.Rows("8:8").Select : myExcel.Selection.RowHeight = 45
  292. xlSheet.Range("A9:C9").Select()
  293. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  294. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  295. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  296. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  297. xlSheet.Rows("9:9").Select : myExcel.Selection.RowHeight = 45
  298. If 不列印金額_ch.Checked = False Then
  299. xlSheet.Range("A11:C11").Select()
  300. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  301. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  302. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  303. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  304. xlSheet.Rows("11:11").Select : myExcel.Selection.RowHeight = 15.75
  305. xlSheet.Range("A12:C12").Select()
  306. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  307. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  308. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  309. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  310. xlSheet.Rows("12:12").Select : myExcel.Selection.RowHeight = 15.75
  311. xlSheet.Range("A13:C13").Select()
  312. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  313. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  314. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  315. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  316. xlSheet.Rows("13:13").Select : myExcel.Selection.RowHeight = 15.75
  317. xlSheet.Range("A14:C14").Select()
  318. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  319. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  320. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  321. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  322. xlSheet.Rows("14:14").Select : myExcel.Selection.RowHeight = 15.75
  323. xlSheet.Range("A16:C16").Select()
  324. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  325. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  326. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  327. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  328. xlSheet.Rows("16:16").Select : myExcel.Selection.RowHeight = 15.75
  329. xlSheet.Range("A17:C17").Select()
  330. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  331. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  332. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  333. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  334. xlSheet.Rows("17:17").Select : myExcel.Selection.RowHeight = 15.75
  335. xlSheet.Range("A19:C19").Select()
  336. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  337. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  338. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  339. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  340. xlSheet.Rows("19:19").Select : myExcel.Selection.RowHeight = 15.75
  341. xlSheet.Range("A20:C20").Select()
  342. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  343. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  344. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  345. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  346. xlSheet.Rows("20:20").Select : myExcel.Selection.RowHeight = 15.75
  347. xlSheet.Range("A22:C22").Select()
  348. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  349. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  350. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  351. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  352. xlSheet.Rows("22:22").Select : myExcel.Selection.RowHeight = 250
  353. xlSheet.Range("A24:C24").Select()
  354. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  355. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  356. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  357. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  358. xlSheet.Rows("24:24").Select : myExcel.Selection.RowHeight = 15.75
  359. xlSheet.Range("A25:C25").Select()
  360. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  361. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  362. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  363. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  364. xlSheet.Rows("25:25").Select : myExcel.Selection.RowHeight = 35
  365. xlSheet.Range("A27:C27").Select()
  366. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  367. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  368. xlSheet.Rows("28:28").Select : myExcel.Selection.RowHeight = 90
  369. xlSheet.Range("A28").Select()
  370. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  371. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  372. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  373. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  374. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  375. xlSheet.Range("C28").Select()
  376. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  377. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  378. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  379. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  380. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  381. xlSheet.Rows("10:10").Select : myExcel.Selection.RowHeight = 8 : xlSheet.Rows("15:15").Select : myExcel.Selection.RowHeight = 8
  382. xlSheet.Rows("18:18").Select : myExcel.Selection.RowHeight = 8 : xlSheet.Rows("21:21").Select : myExcel.Selection.RowHeight = 8
  383. Else
  384. xlSheet.Range("A11:C11").Select()
  385. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  386. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  387. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  388. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  389. xlSheet.Rows("11:11").Select : myExcel.Selection.RowHeight = 400
  390. xlSheet.Range("A13:C13").Select()
  391. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  392. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  393. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  394. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  395. xlSheet.Rows("13:13").Select : myExcel.Selection.RowHeight = 15.75
  396. xlSheet.Range("A14:C14").Select()
  397. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  398. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  399. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  400. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  401. xlSheet.Rows("14:14").Select : myExcel.Selection.RowHeight = 35
  402. xlSheet.Range("A16:C16").Select()
  403. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  404. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  405. xlSheet.Rows("17:17").Select : myExcel.Selection.RowHeight = 90
  406. xlSheet.Range("A17").Select()
  407. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  408. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  409. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  410. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  411. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  412. xlSheet.Range("C17").Select()
  413. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  414. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  415. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  416. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  417. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  418. End If
  419. myExcel.ActiveWindow.DisplayGridlines = False
  420. xlSheet.Range("D1").Select()
  421. End Sub
  422. Private Sub CC(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  423. Clipboard.SetDataObject(PictureBox1.Image)
  424. xlSheet.Range("A1").Select()
  425. myExcel.ActiveSheet.Pictures.Paste.Select
  426. myExcel.Selection.ShapeRange.Height = 93
  427. myExcel.Selection.ShapeRange.IncrementLeft(0)
  428. myExcel.Selection.ShapeRange.IncrementTop(0)
  429. End Sub
  430. Private Sub DD(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  431. Clipboard.SetDataObject(PictureBox2.Image)
  432. xlSheet.Range("A1").Select()
  433. myExcel.ActiveSheet.Pictures.Paste.Select
  434. myExcel.Selection.ShapeRange.Height = 93
  435. myExcel.Selection.ShapeRange.IncrementLeft(0)
  436. myExcel.Selection.ShapeRange.IncrementTop(0)
  437. End Sub
  438. Private Sub FF(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  439. myExcel.Application.PrintCommunication = False : With myExcel.ActiveSheet.PageSetup : .PrintTitleRows = "" : .PrintTitleColumns = "" : End With
  440. myExcel.Application.PrintCommunication = True : myExcel.ActiveSheet.PageSetup.PrintArea = "" : myExcel.Application.PrintCommunication = False
  441. With myExcel.ActiveSheet.PageSetup : .LeftHeader = "" : .CenterHeader = "" : .RightHeader = "" : .LeftFooter = "" : .CenterFooter = "第 &P 頁,共 &N 頁" : .RightFooter = ""
  442. .LeftMargin = myExcel.Application.InchesToPoints(0.236220472440945) : .RightMargin = myExcel.Application.InchesToPoints(0.236220472440945)
  443. .TopMargin = myExcel.Application.InchesToPoints(0.748031496062992) : .BottomMargin = myExcel.Application.InchesToPoints(0.748031496062992)
  444. .HeaderMargin = myExcel.Application.InchesToPoints(0.31496062992126) : .FooterMargin = myExcel.Application.InchesToPoints(0.31496062992126)
  445. .PrintHeadings = False : .PrintGridlines = False : .CenterHorizontally = True : .CenterVertically = False : .Draft = False
  446. .FirstPageNumber = xlAutomatic : .BlackAndWhite = False : .Zoom = False : .FitToPagesWide = 1 : .FitToPagesTall = False : .OddAndEvenPagesHeaderFooter = False
  447. .DifferentFirstPageHeaderFooter = False : .ScaleWithDocHeaderFooter = True : .AlignMarginsHeaderFooter = True
  448. .EvenPage.LeftHeader.Text = "" : .EvenPage.CenterHeader.Text = "" : .EvenPage.RightHeader.Text = "" : .EvenPage.LeftFooter.Text = ""
  449. .EvenPage.CenterFooter.Text = "" : .EvenPage.RightFooter.Text = "" : .FirstPage.LeftHeader.Text = "" : .FirstPage.CenterHeader.Text = ""
  450. .FirstPage.RightHeader.Text = "" : .FirstPage.LeftFooter.Text = "" : .FirstPage.CenterFooter.Text = "" : .FirstPage.RightFooter.Text = ""
  451. End With : myExcel.Application.PrintCommunication = True
  452. End Sub
  453. End Class