Option Strict Off Imports System.IO Imports Microsoft.Office.Interop.Excel.XlUnderlineStyle Imports Microsoft.Office.Interop.Excel.Constants Imports Microsoft.Office.Interop.Excel.XlBordersIndex Imports Microsoft.Office.Interop.Excel.XlLineStyle Imports Microsoft.Office.Interop.Excel.XlBorderWeight Imports Microsoft.Office.Interop.Excel.XlThemeFont Imports Microsoft.Office.Interop.Excel.XlThemeColor Imports Microsoft.Office.Interop.Excel.XlWindowState Imports Microsoft.Office.Interop.Excel Public Class 財物支付單申請_傳票 Dim SK1, SK2 As String : Dim 不可編輯x, 已開啟 As Boolean Dim 新項次 As String : Dim 新流水1 As String : Dim 新流水2 As String Dim NUM1 As Integer : Dim 匯率1 As Double : Dim 對話框(20) As String Dim xlApp As Application Dim xlBook As Workbook Dim xlSheet As Worksheet Private Sub 語言轉換讀取() If 系統語言 = "繁體中文" Then : 語言 = "CH" : ElseIf 系統語言 = "English" Then : 語言 = "EN" : ElseIf 系統語言 = "Indonesian" Then : 語言 = "IN" : End If If 跨部門開啟 = False Then : Me.Text = 系統語言字典("H001-112-" & 語言) : Else : Me.Text = 系統語言字典("H001-113-" & 語言) : End If 財務單號_lb.Text = 系統語言字典("H301-129-" & 語言) : Label1.Text = 系統語言字典("H314-100-" & 語言) : Label2.Text = 系統語言字典("H314-101-" & 語言) Label3.Text = 系統語言字典("H314-102-" & 語言) : Label4.Text = 系統語言字典("H314-103-" & 語言) : Label5.Text = 系統語言字典("H314-104-" & 語言) Label6.Text = 系統語言字典("H314-105-" & 語言) : 會計科目_lb.Text = 系統語言字典("H301-120-" & 語言) : 表頭(113) = 系統語言字典("H204-120-" & 語言) 表頭(112) = 系統語言字典("H301-107-" & 語言) : 表頭(39) = 系統語言字典("H301-134-" & 語言) : 表頭(111) = 系統語言字典("H301-108-" & 語言) 表頭(20) = 系統語言字典("H314-124-" & 語言) : 表頭(107) = 系統語言字典("H301-111-" & 語言) : 表頭(109) = 系統語言字典("H301-109-" & 語言) 表頭(11) = 系統語言字典("H301-112-" & 語言) : 表頭(114) = 系統語言字典("H301-113-" & 語言) : 表頭(98) = 系統語言字典("H301-114-" & 語言) 表頭(115) = 系統語言字典("H301-116-" & 語言) : 表頭(108) = 系統語言字典("H301-117-" & 語言) : 表頭(110) = 系統語言字典("H301-115-" & 語言) Label8.Text = 系統語言字典("H314-106-" & 語言) : Label9.Text = 系統語言字典("H314-107-" & 語言) : Label10.Text = 系統語言字典("H314-108-" & 語言) Label11.Text = 系統語言字典("H314-109-" & 語言) : Label12.Text = 系統語言字典("H314-110-" & 語言) : 對話框(2) = 系統語言字典("H301-125-" & 語言) 對話框(3) = 系統語言字典("G000-117-" & 語言) : 對話框(1) = 系統語言字典("H301-124-" & 語言) : 表頭(1) = 系統語言字典("H314-106-" & 語言) 對話框(4) = 系統語言字典("H301-127-" & 語言) : 對話框(5) = 系統語言字典("H302-119-" & 語言) : 對話框(6) = 系統語言字典("H302-120-" & 語言) 對話框(7) = 系統語言字典("H302-121-" & 語言) : 表頭(2) = 系統語言字典("H507-121-" & 語言) : 表頭(3) = 系統語言字典("H314-111-" & 語言) 對話框(8) = 系統語言字典("H314-112-" & 語言) : Label18.Text = 系統語言字典("H314-113-" & 語言) : Label15.Text = 系統語言字典("H314-114-" & 語言) Label17.Text = 系統語言字典("H314-115-" & 語言) : Label16.Text = 系統語言字典("H314-116-" & 語言) : Label19.Text = 系統語言字典("H301-140-" & 語言) 對話框(9) = 系統語言字典("H314-123-" & 語言) : Label20.Text = 系統語言字典("H314-124-" & 語言) : 對話框(10) = 系統語言字典("H303-129-" & 語言) 對話框(11) = 系統語言字典("H303-102-" & 語言) : 對話框(12) = 系統語言字典("H303-101-" & 語言) : 對話框(13) = 系統語言字典("H611-112-" & 語言) 對話框(14) = 系統語言字典("H611-111-" & 語言) : 對話框(15) = 系統語言字典("H611-113-" & 語言) : 對話框(16) = 系統語言字典("H405-105-" & 語言) 對話框(17) = 系統語言字典("H405-104-" & 語言) : 對話框(18) = 系統語言字典("H405-106-" & 語言) : Label21.Text = 系統語言字典("H303-108-" & 語言) 月_ch.Text = 系統語言字典("H306-106-" & 語言) : 週_ch.Text = 系統語言字典("H303-139-" & 語言) : 日_ch.Text = 系統語言字典("H303-140-" & 語言) 解開星期五_ch.Text = 系統語言字典("H314-129-" & 語言) 修改BT() End Sub Private Sub 修改BT() If 月_ch.Checked Then 當月_bt.Text = 對話框(10) : 上個月_bt.Text = 對話框(11) : 下個月_bt.Text = 對話框(12) ElseIf 週_ch.Checked Then 當月_bt.Text = 對話框(13) : 上個月_bt.Text = 對話框(14) : 下個月_bt.Text = 對話框(15) Else 當月_bt.Text = 對話框(16) : 上個月_bt.Text = 對話框(17) : 下個月_bt.Text = 對話框(18) End If End Sub Private Sub 載入支付對象() Dim ds1 As New DataSet : 支付對象1_dgv.DataSource = Nothing : ds1.Clear() 支付對象1_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing 支付對象1_dgv.ColumnHeadersHeight = 40 : 支付對象1_dgv.AllowUserToAddRows = False SQL_支付對象選單() da.Fill(ds1) : 支付對象1_dgv.DataSource = ds1.Tables(0) : conn.Close() Dim ds2 As New DataSet : 支付對象2_dgv.DataSource = Nothing : ds2.Clear() 支付對象2_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing 支付對象2_dgv.ColumnHeadersHeight = 40 : 支付對象2_dgv.AllowUserToAddRows = False SQL_支付對象選單2() da.Fill(ds2) : 支付對象2_dgv.DataSource = ds2.Tables(0) : conn.Close() 支付對象_cb.Items.Clear() For i As Integer = 0 To 支付對象1_dgv.Rows.Count - 1 支付對象_cb.Items.Add("A-" & 支付對象1_dgv.Rows(i).Cells(2).Value.ToString) Next For j As Integer = 0 To 支付對象2_dgv.Rows.Count - 1 Dim 要加入cb As Boolean = True Dim 要加入的文字 As String = 支付對象2_dgv.Rows(j).Cells(0).Value.ToString For k As Integer = 0 To 支付對象1_dgv.Rows.Count - 1 If 要加入的文字 = 支付對象1_dgv.Rows(k).Cells(2).Value.ToString Then 要加入cb = False Exit For End If Next If 要加入cb Then 支付對象_cb.Items.Add("B-" & 要加入的文字) End If Next End Sub Private Sub Set_清單1() Dim ds1 As New DataSet : 財務收支單_dgv.DataSource = Nothing : ds1.Clear() 財務收支單_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing 財務收支單_dgv.ColumnHeadersHeight = 40 : 財務收支單_dgv.AllowUserToAddRows = False If 條件_cb.Text = "N/A" Then SQL2 = " AND (財務收支控制表.審核人 IS NULL OR 財務收支控制表.審核人 LIKE '') " ElseIf 條件_cb.Text = "App" Then SQL2 = " AND (財務收支控制表.審核人 NOT LIKE '') AND (財務收支控制表.審核人 NOT LIKE N'作廢%') AND (財務收支控制表.審核人 IS NOT NULL) " ElseIf 條件_cb.Text = "Void" Then SQL2 = " AND (財務收支控制表.審核人 LIKE N'作廢-%') " End If If 跨部門開啟 = False Then '-------申請登入時 PA25 = 部門選單_cb.Text & SK2 & SK1 & 年份2_cb.Text Dim 時間條件 As String = "AND (財務收支明細表.支付日期 BETWEEN '" & Strings.Format(開始日期_dtp.Value, "yyyy/MM/dd") & "' AND '" & Strings.Format(結束日期_dtp.Value, "yyyy/MM/dd") & "') " Dim 條件 As String If HX_ch.Checked Then : 條件 = " AND (財務收支明細表.流水號 LIKE N'%HXI%') " ElseIf PGS_ch.Checked Then : 條件 = " AND (財務收支明細表.流水號 LIKE N'%PGS%') " : Else : 條件 = "" : End If SQL_財物支付單申請_查詢財務收支控制表(時間條件, 條件) ElseIf 跨部門開啟 = True Then '-------審核登入時 Dim 條件, 時間條件, 審核條件 As String If HX_ch.Checked Then : 條件 = " AND (財務收支明細表.流水號 LIKE N'%HXI%') " '審X主X O ElseIf PGS_ch.Checked Then : 條件 = " AND (財務收支明細表.流水號 LIKE N'%PGS%') " '審O主X X Else : 條件 = "" : End If '審O主O O 時間條件 = "AND (財務收支明細表.支付日期 BETWEEN '" & Strings.Format(開始日期_dtp.Value, "yyyy/MM/dd") & "' AND '" & Strings.Format(結束日期_dtp.Value, "yyyy/MM/dd") & "') " 審核條件 = "" SQL_財物支付單申請_查詢財務收支控制表1(條件, 時間條件, 審核條件) End If : SQL2 = "" da.Fill(ds1) : 財務收支單_dgv.DataSource = ds1.Tables(0) : conn.Close() 財務收支單_dgv.Columns(0).FillWeight = 125 : 財務收支單_dgv.Columns(1).FillWeight = 75 : 財務收支單_dgv.Columns(2).FillWeight = 120 財務收支單_dgv.Columns(11).FillWeight = 40 : 財務收支單_dgv.Columns(12).FillWeight = 40 財務收支單_dgv.Columns("核准圖檔").Visible = False : 財務收支單_dgv.Columns(11).Visible = False : 財務收支單_dgv.Columns(12).Visible = False 財務收支單_dgv.Columns("檢查人").Visible = False : 財務收支單_dgv.Columns("主管人").Visible = False : 財務收支單_dgv.Columns("申請日期").Visible = False For I As Integer = 3 To 10 : 財務收支單_dgv.Columns(I).Visible = False : Next : For I As Integer = 13 To 15 : 財務收支單_dgv.Columns(I).Visible = False : Next 財務收支單_dgv.Columns(0).ReadOnly = True : 財務收支單_dgv.Columns(1).ReadOnly = True : 財務收支單_dgv.Columns(2).ReadOnly = True For I As Integer = 0 To 財務收支單_dgv.Rows.Count - 1 財務收支單_dgv.Rows(I).Cells(11).Value = False : 財務收支單_dgv.Rows(I).Cells(12).Value = False If Strings.Left(財務收支單_dgv.Rows(I).Cells(10).Value.ToString, 2) = "作廢" Or Strings.Left(財務收支單_dgv.Rows(I).Cells("主管人").Value.ToString, 2) = "作廢" Then 財務收支單_dgv.Rows(I).Cells(12).Value = True End If If 財務收支單_dgv.Rows(I).Cells("主管人").Value.ToString <> "" Then If 財務收支單_dgv.Rows(I).Cells("主管人").Value.ToString.Substring(0, 2) <> "作廢" Then 財務收支單_dgv.Rows(I).Cells(11).Value = True End If End If Next End Sub Private Sub 部門選單下拉清單讀取() SQL_部門選單() : 部門選單_cb.Items.Clear() : While (dr.Read()) : 部門選單_cb.Items.Add(dr("部門")) : End While : conn.Close() End Sub Private Sub 第三層下拉表單資料載入() PA26 = 編號2_cb.Text : SQL_財務單會計科目3() : 第三層_cb.Items.Clear() : 編號3_cb.Items.Clear() : 第三層_cb.Items.Add("") : 編號3_cb.Items.Add("") While (dr.Read()) : 第三層_cb.Items.Add(dr("會計科目")) : 編號3_cb.Items.Add(dr("編號")) : End While : conn.Close() If 第三層_cb.Items.Count <> 0 Then : 第三層_cb.SelectedIndex = 0 : End If End Sub Private Sub 第一層下拉表單資料載入() SQL_財務單會計科目1() : 第一層_cb.Items.Clear() : 編號1_cb.Items.Clear() While (dr.Read()) : 第一層_cb.Items.Add(dr("第一階")) : 編號1_cb.Items.Add(dr("編號")) : End While : conn.Close() : 第一層_cb.Text = "" : 編號1_cb.Text = "" End Sub Private Sub 第二層下拉表單資料載入() PA25 = 編號1_cb.Text : SQL_財務單會計科目2() : 第二層_cb.Items.Clear() : 編號2_cb.Items.Clear() : 第二層_cb.Items.Add("") : 編號2_cb.Items.Add("") While (dr.Read()) : 第二層_cb.Items.Add(dr("第二階")) : 編號2_cb.Items.Add(dr("編號")) : End While : conn.Close() : 第二層_cb.Text = "" : 編號2_cb.Text = "" End Sub Private Sub 匯率() SQL_營運成本收支單申請_查詢匯率() If dr.Read() Then 人民幣匯率_tb.Text = dr("中心匯率").ToString : 美金匯率_tb.Text = dr("美金匯率").ToString : 印尼匯率_tb.Text = dr("印尼盾").ToString : conn.Close() : dr.Close() Else : conn.Close() : dr.Close() : 匯率管理.Close() : 匯率管理.Show() : 匯率管理.BringToFront() : End If End Sub Private Sub Set_切換格式() 明細_dgv.DataSource = Nothing : 單號_tb.Text = "" : 申請人_tb.Text = "" 第三層下拉表單資料載入() : Set_清單1() End Sub Private Sub 財物支付單申請_傳票_Load(sender As Object, e As EventArgs) Handles MyBase.Load 已開啟 = False If 跨部門開啟 = False Then : Me.AutoScroll = True : 首次開啟 = True : 申請_p.Visible = True : 審核_p.Visible = False ElseIf 跨部門開啟 = True Then : Me.MdiParent = HX_PGS_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True : 首次開啟 = True : 申請_p.Visible = False : 審核_p.Visible = True : End If 年份2_cb.Text = Year(Today) : 月份2_cb.SelectedIndex = Month(Today) - 1 : Panel1.SendToBack() : 條件_cb.Text = "N/A" : 支付日期_dtp.Enabled = False 風格() : H(314) = True : 介面 = "H314" : 語言轉換讀取() : 第一層下拉表單資料載入() : 幣別_cb.Text = "IDR" : 顯示說明(999, False) MyMod.清單字體大小調整() 財務收支單_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value) 已開啟 = True End Sub Private Sub 財物支付單申請_傳票_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown 部門選單下拉清單讀取() : 載入支付對象() SQL_主管名稱(2, 23) : If dr.Read Then : 出納人員 = dr("姓名").ToString : End If If 跨部門開啟 = False Then : CB選擇清單(部門選單_cb, 部門選單_cb.Text) : CB選擇清單(選擇公司_cb, 選擇公司_cb.Text) : End If 月_ch.Checked = True : 週_ch.Checked = False : 日_ch.Checked = False : HX_ch.Checked = False : PGS_ch.Checked = False : ALL_ch.Checked = True 當月_bt.PerformClick() If PA48 = "採購" Then : 匯率() : 開立收支單_bt.Visible = False : 申請完成_bt.Visible = False : 首次開啟 = False Else : 匯率() : 幣別_cb.SelectedIndex = 3 : 編號1_cb.Text = "B-02" : 首次開啟 = False : End If : PA48 = "" : 修改BT() End Sub Private Sub 財物支付單申請_傳票_Closed(sender As Object, e As EventArgs) Handles MyBase.Closed If 跨部門開啟 = False Then : H(314) = False : 跨部門開啟 = False ElseIf 跨部門開啟 = True Then : H(314) = False : 跨部門開啟 = False : MyMod.虛擬桌面開啟() : End If End Sub Private Sub 語轉扭_bt_Click(sender As Object, e As EventArgs) Handles 語轉扭_bt.Click 介面 = "H314" : 語言轉換讀取() : Set_清單1() : 第一層下拉表單資料載入() : 幣別_cb.SelectedIndex = 3 : 編號1_cb.Text = "B-02" : 修改BT() : Set_清單1() End Sub Private Sub 登入閒置控制_MouseMove(sender As Object, e As EventArgs) Handles MyBase.MouseMove timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True End Sub Private Sub 登入閒置控制_KeyPress(sender As Object, e As EventArgs) Handles MyBase.KeyPress timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True End Sub Private Sub 財務收支單_dgv_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles 財務收支單_dgv.CellClick If e.RowIndex = -1 Then : Else 單號_tb.Text = 財務收支單_dgv(0, e.RowIndex).Value.ToString : 申請日期_dtp.Value = 財務收支單_dgv("申請日期", e.RowIndex).Value.ToString 申請人_tb.Text = 財務收支單_dgv(2, e.RowIndex).Value.ToString : 系統單號_bt.Text = 財務收支單_dgv(3, e.RowIndex).Value.ToString 幣別_cb.Text = 財務收支單_dgv(4, e.RowIndex).Value.ToString : 編號1_cb.Text = Strings.Left(財務收支單_dgv("類別", e.RowIndex).Value.ToString, 4) 編號2_cb.Text = Strings.Left(財務收支單_dgv("類別", e.RowIndex).Value.ToString, 7) : 編號3_cb.Text = 財務收支單_dgv("類別", e.RowIndex).Value.ToString 金額大寫_tb.Text = 財務收支單_dgv("大寫", e.RowIndex).Value.ToString : 部門選單_cb.Text = Strings.Mid(財務收支單_dgv(0, e.RowIndex).Value.ToString, 5, 3) 內容_tb.Text = 財務收支單_dgv("明細", e.RowIndex).Value.ToString : 支付對象_tb.Text = 財務收支單_dgv("支付對象", e.RowIndex).Value.ToString 營行帳號_tb.Text = 財務收支單_dgv("公司", e.RowIndex).Value.ToString : 支付銀行_tb.Text = 財務收支單_dgv("付款銀行", e.RowIndex).Value.ToString 銀行支行_tb.Text = 財務收支單_dgv("銀行支行", e.RowIndex).Value.ToString : 檢查人_tb.Text = 財務收支單_dgv("檢查人", e.RowIndex).Value.ToString 主管_tb.Text = 財務收支單_dgv("主管人", e.RowIndex).Value.ToString : 支付對象_cb.Text = 財務收支單_dgv("支付對象", e.RowIndex).Value.ToString If 財務收支單_dgv(1, e.RowIndex).Value.ToString <> "" Then : 支付日期_dtp.Value = 財務收支單_dgv(1, e.RowIndex).Value : Else : 支付日期_dtp.Value = Today : End If If 財務收支單_dgv(11, e.RowIndex).Value = True Or 財務收支單_dgv(12, e.RowIndex).Value = True Then : 不可編輯x = True : Else : 不可編輯x = False : End If If Strings.Left(財務收支單_dgv.Rows(e.RowIndex).Cells(10).Value.ToString, 2) = "作廢" Then 審核人_tb.Text = 系統語言字典("H314-111-" & 語言) & Strings.Mid(財務收支單_dgv("審核人", e.RowIndex).Value.ToString, 3, 50) Else : 審核人_tb.Text = 財務收支單_dgv("審核人", e.RowIndex).Value.ToString : End If 申請金額_nud.Value = CLng(財務收支單_dgv("支出", e.RowIndex).Value.ToString) : 大寫轉換() If 財務收支單_dgv(0, e.RowIndex).Value.ToString.Contains("HXI") Then : PictureBox1.BringToFront() ElseIf 財務收支單_dgv(0, e.RowIndex).Value.ToString.Contains("PGS") Then : PictureBox1.SendToBack() : Else : PictureBox1.BringToFront() : End If PA1 = 財務收支單_dgv("核准圖檔", e.RowIndex).Value.ToString : SQL_主管簽名檔管理_圖片流水號() 簽名圖_pb.Image = Nothing While dr.Read() = True Dim unused As Byte() = New Byte(-1) {} Dim bytes As Byte() = DirectCast(dr.Item("簽名檔圖片"), Byte()) Dim oStream As New MemoryStream(bytes) 簽名圖_pb.Image = Bitmap.FromStream(oStream) End While : conn.Close() : 簽名圖_pb.SizeMode = 4 End If End Sub Private Sub ComboBox5_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 第一層_cb.TextChanged 編號1_cb.SelectedIndex = 第一層_cb.SelectedIndex : 查詢_tb.Text = "" : 第二層下拉表單資料載入() : 第三層下拉表單資料載入() End Sub Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 編號1_cb.TextChanged 第一層_cb.SelectedIndex = 編號1_cb.SelectedIndex : 第二層下拉表單資料載入() : 第三層下拉表單資料載入() End Sub Private Sub ComboBox3_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 第二層_cb.TextChanged 編號2_cb.SelectedIndex = 第二層_cb.SelectedIndex : 第三層下拉表單資料載入() End Sub Private Sub ComboBox4_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 編號2_cb.TextChanged 第二層_cb.SelectedIndex = 編號2_cb.SelectedIndex : 第三層下拉表單資料載入() End Sub Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 第三層_cb.SelectedIndexChanged 編號3_cb.SelectedIndex = 第三層_cb.SelectedIndex End Sub Private Sub ComboBox6_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 編號3_cb.SelectedIndexChanged 第三層_cb.SelectedIndex = 編號3_cb.SelectedIndex End Sub Private Sub 部門選單_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 部門選單_cb.SelectedIndexChanged If 首次開啟 = False Then : Set_清單1() : End If End Sub Private Sub 部門選單_cb_Click(sender As Object, e As EventArgs) Handles 部門選單_cb.Click CB選擇清單(部門選單_cb, 部門選單_cb.Text) End Sub Private Sub 重選部門_bt_Click(sender As Object, e As EventArgs) Handles 重選部門_bt.Click CB選擇清單(部門選單_cb, 部門選單_cb.Text) : CB選擇清單(選擇公司_cb, 選擇公司_cb.Text) End Sub Private Sub 第二層_cb_Click(sender As Object, e As EventArgs) Handles 第二層_cb.Click CB選擇清單(第二層_cb, 第二層_cb.Text) End Sub Private Sub 第三層_cb_Click(sender As Object, e As EventArgs) Handles 第三層_cb.Click CB選擇清單(第三層_cb, 第三層_cb.Text) End Sub Private Sub 選擇公司_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 選擇公司_cb.SelectedIndexChanged If 選擇公司_cb.Text = "PT HONG XHE INDUSTRIAL" Then : PictureBox1.BringToFront() : SK2 = "/HXI-PP/" : Else : PictureBox1.SendToBack() : SK2 = "/PGS-PP/" : End If If 首次開啟 = False Then : Set_清單1() : End If End Sub Private Sub 申請日期_dtp_ValueChanged(sender As Object, e As EventArgs) Handles 申請日期_dtp.ValueChanged 匯率() End Sub Private Sub 年份2_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 年份2_cb.SelectedIndexChanged If 首次開啟 = False Then : Set_清單1() : End If End Sub Private Sub 年份2_cb_Click(sender As Object, e As EventArgs) Handles 年份2_cb.Click CB選擇清單(年份2_cb, 年份2_cb.Text) End Sub Private Sub 月份2_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 月份2_cb.SelectedIndexChanged If 月份2_cb.Text = "01" Then : SK1 = "I/" : ElseIf 月份2_cb.Text = "02" Then : SK1 = "II/" : ElseIf 月份2_cb.Text = "03" Then : SK1 = "III/" ElseIf 月份2_cb.Text = "04" Then : SK1 = "IV/" : ElseIf 月份2_cb.Text = "05" Then : SK1 = "V/" : ElseIf 月份2_cb.Text = "06" Then : SK1 = "VI/" ElseIf 月份2_cb.Text = "07" Then : SK1 = "VII/" : ElseIf 月份2_cb.Text = "08" Then : SK1 = "VIII/" : ElseIf 月份2_cb.Text = "09" Then : SK1 = "IX/" ElseIf 月份2_cb.Text = "10" Then : SK1 = "X/" : ElseIf 月份2_cb.Text = "11" Then : SK1 = "XI/" : ElseIf 月份2_cb.Text = "12" Then : SK1 = "XII/" : End If If 首次開啟 = False Then : Set_清單1() : End If End Sub Private Sub 月份2_cb_Click(sender As Object, e As EventArgs) Handles 月份2_cb.Click CB選擇清單(月份2_cb, 月份2_cb.Text) End Sub Private Sub Set_日期格式轉換() If 補單_cb.Checked = False Then : DTP = Strings.Format(Today(), "yyyy/MM/dd") : DTP1 = Strings.Format(Today(), "yyyyMMdd") Else : DTP1 = Strings.Format(申請日期_dtp.Value, "yyyyMMdd") : DTP = Strings.Format(申請日期_dtp.Value, "yyyy/MM/dd") : End If End Sub Private Sub Set_流水號() Dim NUM1 As Integer For NUM1 = 0 To 99 Dim d As String : Dim f As String : Dim g As Integer = 1 If Month(Now) < 10 Then : d = "0" & CStr(Month(Now)) : Else : d = CStr(Month(Now)) : End If If Now.Day() < 10 Then : f = "0" & CStr(Now.Day()) : Else : f = CStr(Now.Day()) : End If If NUM1 < 10 Then : 新流水1 = "B" & Microsoft.VisualBasic.Right(CStr(Year(Now)), 2) & d & f & "0" & NUM1 Else : 新流水1 = "B" & Microsoft.VisualBasic.Right(CStr(Year(Now)), 2) & d & f & NUM1 : End If : PA19 = 新流水1 SQL_營運成本收支單申請_查詢收支單公帳流水號() If dr.Read() Then : conn.Close() : Else : conn.Close() : NUM1 = 99 : End If Next End Sub Private Sub 開立收支單_bt_Click(sender As Object, e As EventArgs) Handles 開立收支單_bt.Click If 編號3_cb.Text = "" Or 幣別_cb.Text = "" Then : MGB(對話框(2), 1) : 首次開啟 = False : Else : 不可編輯x = False If 補單_cb.Checked = False Then : 申請日期_dtp.Value = Today() : End If : 申請人_tb.Text = gUserName Dim today1 As Date = Date.Today Dim dayOfWeek As DayOfWeek = today.DayOfWeek Dim daysToAdd As Integer = If(dayOfWeek <= DayOfWeek.Friday, DayOfWeek.Friday - dayOfWeek, 7 - (dayOfWeek - DayOfWeek.Friday)) Dim nextFriday As Date = today1.AddDays(daysToAdd) 支付日期_dtp.Value = nextFriday ' 將 DateTimePicker 控制元件的值設置為下個星期五 Dim NUM1 As Integer Set_日期格式轉換() For i As Integer = 1 To 999 NUM1 = 0 + i If NUM1 < 10 Then : 系統單號_bt.Text = "OE-" & DTP1 & "-00" & NUM1 ElseIf NUM1 > 9 And NUM1 < 100 Then : 系統單號_bt.Text = "OE-" & DTP1 & "-0" & NUM1 ElseIf NUM1 > 99 Then : 系統單號_bt.Text = "OE-" & DTP1 & "-" & NUM1 End If : conn.Close() : PA = 系統單號_bt.Text : PA15 = 系統單號_bt.Text SQL_營運成本收支單申請_查詢第一筆公帳支付單號() If dr.Read() Then : Else : i = 999 : conn.Close() : End If : conn.Close() Next : SQL_營運成本收支單申請_新增一筆財務收支控制表() : conn.Close() : 申請人_tb.Text = gUserName 月份2_cb.Text = Strings.Mid(Strings.Format(申請日期_dtp.Value, "yyyy/MM/dd"), 6, 2) PA25 = 部門選單_cb.Text & SK2 & SK1 & 年份2_cb.Text : SQL_財物支付單申請_查詢最後一筆公帳支付單號() If dr.Read() Then : 單號_tb.Text = Strings.Left(dr("流水號").ToString, 3) : Else : 單號_tb.Text = "000" : End If : conn.Close() 單號_tb.Text = CInt(單號_tb.Text) + 1 If CInt(單號_tb.Text) < 10 Then : 單號_tb.Text = "00" & CInt(單號_tb.Text) ElseIf CInt(單號_tb.Text) > 9 And CInt(單號_tb.Text) < 100 Then : 單號_tb.Text = "0" & CInt(單號_tb.Text) ElseIf CInt(單號_tb.Text) > 99 And CInt(單號_tb.Text) < 1000 Then : 單號_tb.Text = CInt(單號_tb.Text) : End If 單號_tb.Text = 單號_tb.Text & "-" & 部門選單_cb.Text & SK2 & SK1 & 年份2_cb.Text PA19 = 單號_tb.Text : 新項次 = "01" : PA11 = 新項次 指定會科 = 編號3_cb.Text : PA13 = "0" : PA14 = 申請金額_nud.Value : PA12 = 內容_tb.Text : PA37 = "" : PA38 = 金額大寫_tb.Text : PA39 = 支付對象_tb.Text PA40 = 營行帳號_tb.Text : PA41 = 支付銀行_tb.Text : PA42 = 銀行支行_tb.Text If 幣別_cb.Text = "TWD" Then : 匯率1 = 1 / CDbl(印尼匯率_tb.Text) ElseIf 幣別_cb.Text = "RMB" Then : 匯率1 = CDbl(人民幣匯率_tb.Text) / CDbl(印尼匯率_tb.Text) ElseIf 幣別_cb.Text = "USD" Then : 匯率1 = CDbl(美金匯率_tb.Text) / CDbl(印尼匯率_tb.Text) ElseIf 幣別_cb.Text = "IDR" Then : 匯率1 = 1 End If : PA16 = 匯率1 SQL_新增財物支付單明細表資料(Strings.Format(支付日期_dtp.Value, "yyyy/MM/dd")) : Set_清單1() End If End Sub Private Sub 開立收支單1_bt_Click(sender As Object, e As EventArgs) Handles 開立收支單1_bt.Click If 編號3_cb.Text = "" Or 幣別_cb.Text = "" Then : MGB(對話框(2), 1) : 首次開啟 = False : Else : 不可編輯x = False If 補單_cb.Checked = False Then : 申請日期_dtp.Value = Today() : End If : 申請人_tb.Text = gUserName Dim NUM1 As Integer Set_日期格式轉換() For i As Integer = 1 To 999 NUM1 = 0 + i If NUM1 < 10 Then : 系統單號_bt.Text = "OE-" & DTP1 & "-00" & NUM1 ElseIf NUM1 > 9 And NUM1 < 100 Then : 系統單號_bt.Text = "OE-" & DTP1 & "-0" & NUM1 ElseIf NUM1 > 99 Then : 系統單號_bt.Text = "OE-" & DTP1 & "-" & NUM1 End If : conn.Close() : PA = 系統單號_bt.Text : PA15 = 系統單號_bt.Text SQL_營運成本收支單申請_查詢第一筆公帳支付單號() If dr.Read() Then : Else : i = 999 : conn.Close() : End If : conn.Close() Next : SQL_營運成本收支單申請_新增一筆財務收支控制表() : conn.Close() : 申請人_tb.Text = gUserName 月份2_cb.Text = Strings.Mid(Strings.Format(申請日期_dtp.Value, "yyyy/MM/dd"), 6, 2) PA25 = 部門選單_cb.Text & SK2 & SK1 & 年份2_cb.Text : SQL_財物支付單申請_查詢最後一筆公帳支付單號() If dr.Read() Then : 單號_tb.Text = Strings.Left(dr("流水號").ToString, 3) : Else : 單號_tb.Text = "000" : End If : conn.Close() 單號_tb.Text = CInt(單號_tb.Text) + 1 If CInt(單號_tb.Text) < 10 Then : 單號_tb.Text = "00" & CInt(單號_tb.Text) ElseIf CInt(單號_tb.Text) > 9 And CInt(單號_tb.Text) < 100 Then : 單號_tb.Text = "0" & CInt(單號_tb.Text) ElseIf CInt(單號_tb.Text) > 99 And CInt(單號_tb.Text) < 1000 Then : 單號_tb.Text = CInt(單號_tb.Text) : End If 單號_tb.Text = 單號_tb.Text & "-" & 部門選單_cb.Text & SK2 & SK1 & 年份2_cb.Text PA19 = 單號_tb.Text : 新項次 = "01" : PA11 = 新項次 指定會科 = 編號3_cb.Text : PA13 = "0" : PA14 = 申請金額_nud.Value : PA12 = 內容_tb.Text : PA37 = "" : PA38 = 金額大寫_tb.Text : PA39 = 支付對象_tb.Text PA40 = 營行帳號_tb.Text : PA41 = 支付銀行_tb.Text : PA42 = 銀行支行_tb.Text If 幣別_cb.Text = "TWD" Then : 匯率1 = 1 / CDbl(印尼匯率_tb.Text) ElseIf 幣別_cb.Text = "RMB" Then : 匯率1 = CDbl(人民幣匯率_tb.Text) / CDbl(印尼匯率_tb.Text) ElseIf 幣別_cb.Text = "USD" Then : 匯率1 = CDbl(美金匯率_tb.Text) / CDbl(印尼匯率_tb.Text) ElseIf 幣別_cb.Text = "IDR" Then : 匯率1 = 1 End If : PA16 = 匯率1 SQL_新增財物支付單明細表資料(Strings.Format(支付日期_dtp.Value, "yyyy/MM/dd")) : Set_清單1() End If End Sub Private Sub 刪除收支單_bt_Click(sender As Object, e As EventArgs) Handles 刪除收支單_bt.Click If 不可編輯x = False Then If 系統單號_bt.Text = "" Then : MGB(對話框(3), 1) : 首次開啟 = False : Else MGB(對話框(4), 2) If 訊息回應 = "YES" Then PA20 = 單號_tb.Text Dim ds1 As New DataSet : 採購連結_dgv.DataSource = Nothing : ds1.Clear() 採購連結_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing 採購連結_dgv.ColumnHeadersHeight = 40 : 採購連結_dgv.AllowUserToAddRows = False SQL_財務採購關聯表_反改查詢() da.Fill(ds1) : 採購連結_dgv.DataSource = ds1.Tables(0) : conn.Close() For I As Integer = 0 To 採購連結_dgv.Rows.Count - 1 PA21 = 採購連結_dgv.Rows(I).Cells("採購單號").Value.ToString : SQL_採購單控制表_反改查詢() If dr.Read Then : PA22 = CLng(dr("轉財務金額").ToString) - CLng(採購連結_dgv.Rows(I).Cells("轉財務金額").Value.ToString) : End If SQL_採購單控制表_反改() Next SQL_財務採購關聯表_反改() PA45 = 系統單號_bt.Text : SQL_營運成本收支單申請_刪除財務收支控制表() : SQL_營運成本收支單申請_刪除財務收支明細表() : conn.Close() 第二層_cb.Text = "" : 編號2_cb.Text = "" : 第三層_cb.Text = "" : 編號3_cb.Text = "" : 申請金額_nud.Value = 0 單號_tb.Text = "" : 申請人_tb.Text = "" : 金額大寫_tb.Text = "" : 內容_tb.Text = "" : 支付對象_tb.Text = "" : Set_清單1() End If : 首次開啟 = False End If Else : MGB(對話框(8), 1) : 首次開啟 = False : End If End Sub Private Sub 申請完成_bt_Click(sender As Object, e As EventArgs) Handles 申請完成_bt.Click If 不可編輯x = False Then If 系統單號_bt.Text = "" Then : MGB(對話框(3), 1) : 首次開啟 = False : Else PA1 = 內容_tb.Text : PA2 = 申請金額_nud.Value : PA4 = 編號3_cb.Text : PA3 = 金額大寫_tb.Text : PA6 = 系統單號_bt.Text : PA9 = "01" PA7 = 營行帳號_tb.Text : PA8 = 支付銀行_tb.Text : PA10 = 銀行支行_tb.Text : If 支付對象_tb.Text = "" Then : 支付對象_tb.Text = 支付對象_cb.Text : End If PA5 = 支付對象_tb.Text SQL_財物支付單修改(Strings.Format(支付日期_dtp.Value, "yyyy/MM/dd")) : Set_清單1() : MGB(對話框(1), 1) : 首次開啟 = False End If Else If 登入人級別 = "00" Then PA1 = 內容_tb.Text : PA2 = 申請金額_nud.Value : PA4 = 編號3_cb.Text : PA3 = 金額大寫_tb.Text : PA6 = 系統單號_bt.Text : PA9 = "01" PA7 = 營行帳號_tb.Text : PA8 = 支付銀行_tb.Text : PA10 = 銀行支行_tb.Text : If 支付對象_tb.Text = "" Then : 支付對象_tb.Text = 支付對象_cb.Text : End If PA5 = 支付對象_tb.Text SQL_財物支付單修改(Strings.Format(支付日期_dtp.Value, "yyyy/MM/dd")) : Set_清單1() : MGB(對話框(1), 1) : 首次開啟 = False End If MGB(對話框(8), 1) : 首次開啟 = False End If 解開星期五_ch.Checked = False : 支付日期_dtp.Enabled = False End Sub Private Sub 檢查人_bt_Click(sender As Object, e As EventArgs) Handles 檢查人_bt.Click If CInt(登入人級別) <= 5 Then If 檢查人_tb.Text = "" Then 檢查人_tb.Text = gUserName : SQL_財物支付單修改_檢查人(系統單號_bt.Text, 檢查人_tb.Text) LIN訊息通知("CC209", 出納人員, gUserName, "七日內") : LIN訊息通知("CC209", "李協叡", gUserName, "七日內") End If End If End Sub Private Sub 主管_bt_Click(sender As Object, e As EventArgs) Handles 主管_bt.Click If CInt(登入人級別) <= 3 Then If 主管_tb.Text = "" Then 主管_tb.Text = gUserName : SQL_財物支付單修改_主管(系統單號_bt.Text, 主管_tb.Text) End If End If End Sub Private Sub 審核通過_bt_Click(sender As Object, e As EventArgs) Handles 審核通過_bt.Click If 系統單號_bt.Text = "" Then : MGB(對話框(3), 1) : 首次開啟 = False : Else Set_日期格式轉換() If gUserName = 出納人員 Then : SQL_簽名檔查詢(出納人員) : If dr.Read Then : PA27 = dr("圖片流水號").ToString : Else : PA27 = "PG00000004" : End If Else : PA27 = "" : End If : PA28 = "" : PA29 = 系統單號_bt.Text SQL_營運成本收支單審核_修改財務收支控制表() SQL_營運成本收支單審核_修改財務收支明細表() PA1 = "01" : SQL_營運成本收支單審核_修改財務收支明細表備用金() : SQL_營運成本收支單審核_修改財務收支明細表現金() : SQL_營運成本收支單審核_修改財務收支明細表支出() SQL_營運成本收支單審核_修改財務收支明細表支付日期(Strings.Format(支付日期_dtp.Value, "yyyy/MM/dd")) MGB(對話框(5), 1) : 首次開啟 = False : Set_清單1() LIN訊息通知("CC212", "LIN HSING HAO", 單號_tb.Text, Strings.Format(支付日期_dtp.Value, "yyyy/MM/dd")) LIN訊息通知("CC212", "李協叡", 單號_tb.Text, Strings.Format(支付日期_dtp.Value, "yyyy/MM/dd")) End If End Sub Private Sub 單據作廢_bt_Click(sender As Object, e As EventArgs) Handles 單據作廢_bt.Click If 系統單號_bt.Text = "" Then : MGB(對話框(3), 1) : 首次開啟 = False : Else : INB(對話框(6)) : PA = 訊息回應 If PA = "" Then : MGB(對話框(7), 1) : Else : Set_日期格式轉換() PA42 = 系統單號_bt.Text : SQL_營運成本收支單審核_審核人3() : conn.Close() : MGB(對話框(5), 1) : PA = "" : 首次開啟 = False : Set_清單1() End If End If End Sub Private Sub 申請金額_nud_ValueChanged(sender As Object, e As EventArgs) Handles 申請金額_nud.ValueChanged 大寫轉換() End Sub Private Sub 大寫轉換() Dim 個位(20), 十位(9), 百位(1), 千位(1), 百萬, 十億, 零, 拾, 百, 仟, 萬, 億, 兆, 答案 As String : Dim 數長 As Integer If 系統語言 = "繁體中文" Then 個位(0) = "零" : 個位(1) = "壹" : 個位(2) = "貳" : 個位(3) = "參" : 個位(4) = "肆" : 個位(5) = "伍" : 個位(6) = "陸" : 個位(7) = "柒" : 個位(8) = "捌" : 個位(9) = "玖" 零 = "零" : 拾 = "拾" : 百 = "百" : 仟 = "仟" : 萬 = "萬" : 億 = "億" : 兆 = "兆" ElseIf 系統語言 = "Indonesian" Then 個位(0) = "Nol" : 個位(1) = "Satu" : 個位(2) = "Dua" : 個位(3) = "Tiga" : 個位(4) = "Empat" : 個位(5) = "Lima" : 個位(6) = "Enam" : 個位(7) = "Tujuh" 個位(8) = "Delapan" : 個位(9) = "Sembilan" : 個位(10) = "Sepuluh" : 個位(11) = "Sebelas" : 個位(12) = "Dua Belas" : 個位(13) = "Tiga Belas" : 個位(14) = "Empat Belas" 個位(15) = "Lima Belas" : 個位(16) = "Enam Belas" : 個位(17) = "Tujuh Belas" : 個位(18) = "Delapan Belas" : 個位(19) = "Sembilan Belas" : 個位(20) = "Dua Puluh" 十位(1) = "Sepuluh" : 十位(2) = "Dua Puluh" : 十位(3) = "Tiga Puluh" : 十位(4) = "Empat Puluh" : 十位(5) = "Lima Puluh" : 十位(6) = "Enam Puluh" : 十位(7) = "Tujuh Puluh" 十位(8) = "Delapan Puluh" : 十位(9) = "Sembilan Puluh" 百位(0) = "Seratus" : 百位(1) = "Ratus" : 千位(0) = "Seribu" : 千位(1) = "Ribu" : 百萬 = "Juta" : 十億 = "Miliar" : 兆 = "Triliun" ElseIf 系統語言 = "English" Then 個位(0) = "Zero" : 個位(1) = "One" : 個位(2) = "Two" : 個位(3) = "Three" : 個位(4) = "Four" : 個位(5) = "Five" : 個位(6) = "Six" : 個位(7) = "Seven" 個位(8) = "Eight" : 個位(9) = "Nine" : 個位(10) = "Ten" : 個位(11) = "Eleven" : 個位(12) = "Twelve" : 個位(13) = "Thirteen" : 個位(14) = "Fourteen" 個位(15) = "Fifteen" : 個位(16) = "Sixteen" : 個位(17) = "Seventeen" : 個位(18) = "Eighteen" : 個位(19) = "Nineteen" : 個位(20) = "Twenty" 十位(1) = "Ten" : 十位(2) = "Twenty" : 十位(3) = "Thirty" : 十位(4) = "Forty" : 十位(5) = "Fifty" : 十位(6) = "Sixty" : 十位(7) = "Seventy" : 十位(8) = "Eighty" 十位(9) = "Ninety" 百位(0) = "One Hundred" : 百位(1) = "Hundred" : 千位(0) = "One Thousand" : 千位(1) = "Thousand" : 百萬 = "Million" : 十億 = "Billion" : 兆 = "Trillion" End If '--------------轉大寫----------------------------------------------------------- Dim 位數(13), 末位數 As String Dim NB As Long = 申請金額_nud.Value : Dim NBS As String = NB.ToString() : 數長 = NBS.Length 位數(1) = Strings.Left(NBS, 1) : 末位數 = Strings.Right(NBS, 1) If 數長 >= 2 Then : 位數(2) = Strings.Mid(NBS, 2, 1) : End If : If 數長 >= 3 Then : 位數(3) = Strings.Mid(NBS, 3, 1) : End If If 數長 >= 4 Then : 位數(4) = Strings.Mid(NBS, 4, 1) : End If : If 數長 >= 5 Then : 位數(5) = Strings.Mid(NBS, 5, 1) : End If If 數長 >= 6 Then : 位數(6) = Strings.Mid(NBS, 6, 1) : End If : If 數長 >= 7 Then : 位數(7) = Strings.Mid(NBS, 7, 1) : End If If 數長 >= 8 Then : 位數(8) = Strings.Mid(NBS, 8, 1) : End If : If 數長 >= 9 Then : 位數(9) = Strings.Mid(NBS, 9, 1) : End If If 數長 >= 10 Then : 位數(10) = Strings.Mid(NBS, 10, 1) : End If : If 數長 >= 11 Then : 位數(11) = Strings.Mid(NBS, 11, 1) : End If If 數長 >= 12 Then : 位數(12) = Strings.Mid(NBS, 12, 1) : End If : If 數長 >= 13 Then : 位數(13) = Strings.Mid(NBS, 13, 1) : End If If 系統語言 <> "繁體中文" Then If 申請金額_nud.Value < 21 Then : 答案 = 個位(申請金額_nud.Value) ElseIf 數長 = 2 Then If 位數(2) <> "0" And 末位數 = "0" Then : 答案 = 十位(位數(1)) ElseIf 位數(2) <> "0" And 末位數 <> "0" Then : 答案 = 十位(位數(1)) & " " & 個位(末位數) : End If ElseIf 數長 = 3 Then '------------------百------------------------------------------------------------------------------------------------------ If 位數(1) = "1" Then : 答案 = 百位(0) : ElseIf 位數(1) <> "1" Then : 答案 = 個位(位數(1)) & " " & 百位(1) : End If '------------------個十------------------------------------------------------------------------------------------------------ If 位數(2) = "0" And 末位數 = "0" Then ElseIf 位數(2) = "0" And 末位數 <> "0" Then : 答案 &= " " & 個位(末位數) Else If CInt(位數(2) & 末位數) < 21 Then If 末位數 = "0" Then : 答案 &= " " & 十位(位數(2)) : Else : 答案 &= " " & 個位(位數(2) & 末位數) : End If Else If 位數(2) <> "0" And 末位數 = "0" Then : 答案 &= " " & 十位(位數(2)) ElseIf 位數(2) <> "0" And 末位數 <> "0" Then : 答案 &= " " & 十位(位數(2)) & " " & 個位(末位數) : End If End If End If ElseIf 數長 = 4 Then '------------------千------------------------------------------------------------------------------------------------------ If 位數(1) = "1" Then : 答案 = 千位(0) ElseIf 位數(1) <> "1" Then : 答案 = 個位(位數(1)) & " " & 千位(1) : End If '------------------百------------------------------------------------------------------------------------------------------ If CInt(位數(2) & 位數(3) & 末位數) < 100 Then ElseIf CInt(位數(2) & 位數(3) & 末位數) < 200 Then : 答案 &= " " & 百位(0) ElseIf CInt(位數(2) & 位數(3) & 末位數) >= 200 Then : 答案 &= " " & 個位(位數(2)) & " " & 百位(1) : End If '------------------個十------------------------------------------------------------------------------------------------------ If 位數(3) = "0" And 末位數 = "0" Then ElseIf 位數(3) = "0" And 末位數 <> "0" Then : 答案 &= " " & 個位(末位數) Else If CInt(位數(3) & 末位數) < 21 Then If 末位數 = "0" Then : 答案 &= " " & 十位(位數(3)) : Else : 答案 &= " " & 個位(位數(3) & 末位數) : End If Else If 位數(3) <> "0" And 末位數 = "0" Then : 答案 &= " " & 十位(位數(3)) ElseIf 位數(3) <> "0" And 末位數 <> "0" Then : 答案 &= " " & 十位(位數(3)) & " " & 個位(末位數) : End If End If End If ElseIf 數長 = 5 Then '------------------十千(萬)------------------------------------------------------------------------------------------------------ If CInt(位數(1) & 位數(2)) < 21 Then If 位數(2) = "0" Then : 答案 = 十位(位數(1)) & " " & 千位(1) : Else : 答案 = 個位(位數(1) & 位數(2)) & " " & 千位(1) : End If Else If 位數(1) <> "0" And 位數(2) = "0" Then : 答案 = 十位(位數(1)) & " " & 千位(1) ElseIf 位數(1) <> "0" And 位數(2) <> "0" Then : 答案 = 十位(位數(1)) & " " & 個位(位數(2)) & " " & 千位(1) : End If End If '------------------百------------------------------------------------------------------------------------------------------ If CInt(位數(3) & 位數(4) & 末位數) < 100 Then ElseIf CInt(位數(3) & 位數(4) & 末位數) < 200 Then : 答案 &= " " & 百位(0) ElseIf CInt(位數(3) & 位數(4) & 末位數) >= 200 Then : 答案 &= " " & 個位(位數(3)) & " " & 百位(1) : End If '------------------個十------------------------------------------------------------------------------------------------------ If 位數(4) = "0" And 末位數 = "0" Then ElseIf 位數(4) = "0" And 末位數 <> "0" Then : 答案 &= " " & 個位(末位數) Else If CInt(位數(4) & 末位數) < 21 Then If 末位數 = "0" Then : 答案 &= " " & 十位(位數(4)) : Else : 答案 &= " " & 個位(位數(4) & 末位數) : End If Else If 位數(4) <> "0" And 末位數 = "0" Then : 答案 &= " " & 十位(位數(4)) ElseIf 位數(4) <> "0" And 末位數 <> "0" Then : 答案 &= " " & 十位(位數(4)) & " " & 個位(末位數) : End If End If End If ElseIf 數長 = 6 Then '------------------百千(十萬)------------------------------------------------------------------------------------------------------ If CInt(位數(1)) = 1 Then : 答案 = 百位(0) : Else : 答案 = 個位(位數(1)) & " " & 百位(1) : End If '------------------十千(萬)------------------------------------------------------------------------------------------------------ If CInt(位數(2) & 位數(3)) < 21 Then If 位數(3) = "0" Then : 答案 &= " " & 十位(位數(2)) & " " & 千位(1) : Else : 答案 &= " " & 個位(位數(2) & 位數(3)) & " " & 千位(1) : End If Else If 位數(2) <> "0" And 位數(3) = "0" Then : 答案 &= " " & 十位(位數(2)) & " " & 千位(1) ElseIf 位數(2) <> "0" And 位數(3) <> "0" Then : 答案 &= " " & 十位(位數(2)) & " " & 個位(位數(3)) & " " & 千位(1) : End If End If '------------------百------------------------------------------------------------------------------------------------------ If CInt(位數(4) & 位數(5) & 末位數) < 100 Then ElseIf CInt(位數(4) & 位數(5) & 末位數) < 200 Then : 答案 &= " " & 百位(0) ElseIf CInt(位數(4) & 位數(5) & 末位數) >= 200 Then : 答案 &= " " & 個位(位數(4)) & " " & 百位(1) : End If '------------------個十------------------------------------------------------------------------------------------------------ If 位數(5) = "0" And 末位數 = "0" Then ElseIf 位數(5) = "0" And 末位數 <> "0" Then : 答案 &= " " & 個位(末位數) Else If CInt(位數(5) & 末位數) < 21 Then If 末位數 = "0" Then : 答案 &= " " & 十位(位數(5)) : Else : 答案 &= " " & 個位(位數(5) & 末位數) : End If Else If 位數(5) <> "0" And 末位數 = "0" Then : 答案 &= " " & 十位(位數(5)) ElseIf 位數(5) <> "0" And 末位數 <> "0" Then : 答案 &= " " & 十位(位數(5)) & " " & 個位(末位數) : End If End If End If ElseIf 數長 = 7 Then '------------------百萬------------------------------------------------------------------------------------------------------ 答案 = 個位(位數(1)) & " " & 百萬 '------------------百千(十萬)------------------------------------------------------------------------------------------------------ If CInt(位數(2)) = 0 Then : ElseIf CInt(位數(2)) = 1 Then : 答案 &= " " & 百位(0) ElseIf CInt(位數(2)) > 1 Then : 答案 &= " " & 個位(位數(2)) & " " & 百位(1) : End If '------------------十千(萬)------------------------------------------------------------------------------------------------------ If 位數(2) = "0" And 位數(3) = "0" And 位數(4) = "0" Then : Else If CInt(位數(3) & 位數(4)) < 21 Then If 位數(3) = "0" And 位數(4) = "0" Then : 答案 &= " " & 千位(1) ElseIf 位數(3) = "0" And 位數(4) <> "0" Then : 答案 &= " " & 個位(位數(4)) & " " & 千位(1) ElseIf 位數(3) <> "0" And 位數(4) = "0" Then : 答案 &= " " & 十位(位數(3)) & " " & 千位(1) ElseIf 位數(3) <> "0" And 位數(4) <> "0" Then : 答案 &= " " & 個位(位數(3) & 位數(4)) & " " & 千位(1) : End If Else If 位數(3) <> "0" And 位數(4) = "0" Then : 答案 &= " " & 十位(位數(3)) & " " & 千位(1) ElseIf 位數(3) <> "0" And 位數(4) <> "0" Then : 答案 &= " " & 十位(位數(3)) & " " & 個位(位數(4)) & " " & 千位(1) : End If End If End If '------------------百------------------------------------------------------------------------------------------------------ If CInt(位數(5) & 位數(6) & 末位數) < 100 Then ElseIf CInt(位數(5) & 位數(6) & 末位數) < 200 Then : 答案 &= " " & 百位(0) ElseIf CInt(位數(5) & 位數(6) & 末位數) >= 200 Then : 答案 &= " " & 個位(位數(5)) & " " & 百位(1) : End If '------------------個十------------------------------------------------------------------------------------------------------ If 位數(6) = "0" And 末位數 = "0" Then ElseIf 位數(6) = "0" And 末位數 <> "0" Then : 答案 &= " " & 個位(末位數) Else If CInt(位數(6) & 末位數) < 21 Then If 末位數 = "0" Then : 答案 &= " " & 十位(位數(6)) : Else : 答案 &= " " & 個位(位數(6) & 末位數) : End If Else If 位數(6) <> "0" And 末位數 = "0" Then : 答案 &= " " & 十位(位數(6)) ElseIf 位數(6) <> "0" And 末位數 <> "0" Then : 答案 &= " " & 十位(位數(6)) & " " & 個位(末位數) : End If End If End If ElseIf 數長 = 8 Then '------------------十百萬(千萬)------------------------------------------------------------------------------------------------------ If CInt(位數(1) & 位數(2)) < 21 Then If 位數(2) = "0" Then : 答案 = 十位(位數(1)) & " " & 百萬 : Else : 答案 = 個位(位數(1) & 位數(2)) & " " & 百萬 : End If Else If 位數(1) <> "0" And 位數(2) = "0" Then : 答案 = 十位(位數(1)) & " " & 百萬 ElseIf 位數(1) <> "0" And 位數(2) <> "0" Then : 答案 = 十位(位數(1)) & " " & 個位(位數(2)) & " " & 百萬 : End If End If '------------------百千(十萬)------------------------------------------------------------------------------------------------------ If CInt(位數(3)) = 0 Then : ElseIf CInt(位數(3)) = 1 Then : 答案 &= " " & 百位(0) ElseIf CInt(位數(3)) > 1 Then : 答案 &= " " & 個位(位數(3)) & " " & 百位(1) : End If '------------------十千(萬)------------------------------------------------------------------------------------------------------ If 位數(3) = "0" And 位數(4) = "0" And 位數(5) = "0" Then : Else If CInt(位數(4) & 位數(5)) < 21 Then If 位數(4) = "0" And 位數(5) = "0" Then : 答案 &= " " & 千位(1) ElseIf 位數(4) = "0" And 位數(5) <> "0" Then : 答案 &= " " & 個位(位數(5)) & " " & 千位(1) ElseIf 位數(4) <> "0" And 位數(5) = "0" Then : 答案 &= " " & 十位(位數(4)) & " " & 千位(1) ElseIf 位數(4) <> "0" And 位數(5) <> "0" Then : 答案 &= " " & 個位(位數(4) & 位數(5)) & " " & 千位(1) : End If Else If 位數(4) <> "0" And 位數(5) = "0" Then : 答案 &= " " & 十位(位數(4)) & " " & 千位(1) ElseIf 位數(4) <> "0" And 位數(5) <> "0" Then : 答案 &= " " & 十位(位數(4)) & " " & 個位(位數(5)) & " " & 千位(1) : End If End If End If '------------------百------------------------------------------------------------------------------------------------------ If CInt(位數(6) & 位數(7) & 末位數) < 100 Then ElseIf CInt(位數(6) & 位數(7) & 末位數) < 200 Then : 答案 &= " " & 百位(0) ElseIf CInt(位數(6) & 位數(7) & 末位數) >= 200 Then : 答案 &= " " & 個位(位數(6)) & " " & 百位(1) : End If '------------------個十------------------------------------------------------------------------------------------------------ If 位數(7) = "0" And 末位數 = "0" Then ElseIf 位數(7) = "0" And 末位數 <> "0" Then : 答案 &= " " & 個位(末位數) Else If CInt(位數(7) & 末位數) < 21 Then If 末位數 = "0" Then : 答案 &= " " & 十位(位數(7)) : Else : 答案 &= " " & 個位(位數(7) & 末位數) : End If Else If 位數(7) <> "0" And 末位數 = "0" Then : 答案 &= " " & 十位(位數(7)) ElseIf 位數(7) <> "0" And 末位數 <> "0" Then : 答案 &= " " & 十位(位數(7)) & " " & 個位(末位數) : End If End If End If ElseIf 數長 = 9 Then '------------------百百萬(億)------------------------------------------------------------------------------------------------------ If CInt(位數(1)) = 1 Then : 答案 = 百位(0) : ElseIf CInt(位數(1)) > 1 Then : 答案 = 個位(位數(1)) & " " & 百位(1) : End If '------------------十百萬(千萬)------------------------------------------------------------------------------------------------------ If 位數(2) = "0" And 位數(3) = "0" Then : 答案 &= " " & 百萬 ElseIf 位數(2) = "0" And 位數(3) <> "0" Then : 答案 &= " " & 個位(位數(3)) & " " & 百萬 ElseIf CInt(位數(2) & 位數(3)) < 21 Then If 位數(3) = "0" Then : 答案 &= " " & 十位(位數(2)) & " " & 百萬 : Else : 答案 &= " " & 個位(位數(2) & 位數(3)) & " " & 百萬 : End If ElseIf CInt(位數(2) & 位數(3)) >= 21 Then If 位數(2) <> "0" And 位數(3) = "0" Then : 答案 &= " " & 十位(位數(2)) & " " & 百萬 ElseIf 位數(2) <> "0" And 位數(3) <> "0" Then : 答案 &= " " & 十位(位數(2)) & " " & 個位(位數(3)) & " " & 百萬 : End If End If '------------------百千(十萬)------------------------------------------------------------------------------------------------------ If CInt(位數(4)) = 0 Then : ElseIf CInt(位數(4)) = 1 Then : 答案 &= " " & 百位(0) ElseIf CInt(位數(4)) > 1 Then : 答案 &= " " & 個位(位數(4)) & " " & 百位(1) : End If '------------------十千(萬)------------------------------------------------------------------------------------------------------ If 位數(4) = "0" And 位數(5) = "0" And 位數(6) = "0" Then : Else If CInt(位數(5) & 位數(6)) < 21 Then If 位數(5) = "0" And 位數(6) = "0" Then : 答案 &= " " & 千位(1) ElseIf 位數(5) = "0" And 位數(6) <> "0" Then : 答案 &= " " & 個位(位數(6)) & " " & 千位(1) ElseIf 位數(5) <> "0" And 位數(6) = "0" Then : 答案 &= " " & 十位(位數(5)) & " " & 千位(1) ElseIf 位數(5) <> "0" And 位數(6) <> "0" Then : 答案 &= " " & 個位(位數(5) & 位數(6)) & " " & 千位(1) : End If Else If 位數(5) <> "0" And 位數(6) = "0" Then : 答案 &= " " & 十位(位數(5)) & " " & 千位(1) ElseIf 位數(5) <> "0" And 位數(6) <> "0" Then : 答案 &= " " & 十位(位數(5)) & " " & 個位(位數(6)) & " " & 千位(1) : End If End If End If '------------------百------------------------------------------------------------------------------------------------------ If CInt(位數(7) & 位數(8) & 末位數) < 100 Then ElseIf CInt(位數(7) & 位數(8) & 末位數) < 200 Then : 答案 &= " " & 百位(0) ElseIf CInt(位數(7) & 位數(8) & 末位數) >= 200 Then : 答案 &= " " & 個位(位數(7)) & " " & 百位(1) : End If '------------------個十------------------------------------------------------------------------------------------------------ If 位數(8) = "0" And 末位數 = "0" Then ElseIf 位數(8) = "0" And 末位數 <> "0" Then : 答案 &= " " & 個位(末位數) Else If CInt(位數(8) & 末位數) < 21 Then If 末位數 = "0" Then : 答案 &= " " & 十位(位數(8)) : Else : 答案 &= " " & 個位(位數(8) & 末位數) : End If Else If 位數(8) <> "0" And 末位數 = "0" Then : 答案 &= " " & 十位(位數(8)) ElseIf 位數(8) <> "0" And 末位數 <> "0" Then : 答案 &= " " & 十位(位數(8)) & " " & 個位(末位數) : End If End If End If ElseIf 數長 = 10 Then '------------------十億------------------------------------------------------------------------------------------------------ 答案 = 個位(位數(1)) & " " & 十億 '------------------百百萬(億)------------------------------------------------------------------------------------------------------ If CInt(位數(2)) = 0 Then ElseIf CInt(位數(2)) = 1 Then : 答案 &= " " & 百位(0) ElseIf CInt(位數(2)) > 1 Then : 答案 &= " " & 個位(位數(2)) & " " & 百位(1) : End If '------------------十百萬(千萬)------------------------------------------------------------------------------------------------------ If 位數(2) = "0" And 位數(3) = "0" And 位數(4) = "0" Then ElseIf 位數(3) = "0" And 位數(4) = "0" Then : 答案 &= " " & 百萬 ElseIf 位數(3) = "0" And 位數(4) <> "0" Then : 答案 &= " " & 個位(位數(4)) & " " & 百萬 ElseIf CInt(位數(3) & 位數(4)) < 21 Then If 位數(4) = "0" Then : 答案 &= " " & 十位(位數(3)) & " " & 百萬 : Else : 答案 &= " " & 個位(位數(3) & 位數(4)) & " " & 百萬 : End If ElseIf CInt(位數(3) & 位數(4)) >= 21 Then If 位數(3) <> "0" And 位數(4) = "0" Then : 答案 &= " " & 十位(位數(3)) & " " & 百萬 ElseIf 位數(3) <> "0" And 位數(4) <> "0" Then : 答案 &= " " & 十位(位數(3)) & " " & 個位(位數(4)) & " " & 百萬 : End If End If '------------------百千(十萬)------------------------------------------------------------------------------------------------------ If CInt(位數(5)) = 0 Then : ElseIf CInt(位數(5)) = 1 Then : 答案 &= " " & 百位(0) ElseIf CInt(位數(5)) > 1 Then : 答案 &= " " & 個位(位數(5)) & " " & 百位(1) : End If '------------------十千(萬)------------------------------------------------------------------------------------------------------ If CInt(位數(6) & 位數(7)) < 21 Then If 位數(5) = "0" And 位數(6) = "0" And 位數(7) = "0" Then ElseIf 位數(6) = "0" And 位數(7) = "0" Then : 答案 &= " " & 千位(1) ElseIf 位數(6) = "0" And 位數(7) <> "0" Then : 答案 &= " " & 個位(位數(7)) & " " & 千位(1) ElseIf 位數(6) <> "0" And 位數(7) = "0" Then : 答案 &= " " & 十位(位數(6)) & " " & 千位(1) ElseIf 位數(6) <> "0" And 位數(7) <> "0" Then : 答案 &= " " & 個位(位數(6) & 位數(7)) & " " & 千位(1) : End If Else If 位數(6) <> "0" And 位數(7) = "0" Then : 答案 &= " " & 十位(位數(6)) & " " & 千位(1) ElseIf 位數(6) <> "0" And 位數(7) <> "0" Then : 答案 &= " " & 十位(位數(6)) & " " & 個位(位數(7)) & " " & 千位(1) : End If End If '------------------百------------------------------------------------------------------------------------------------------ If CInt(位數(8) & 位數(9) & 末位數) < 100 Then ElseIf CInt(位數(8) & 位數(9) & 末位數) < 200 Then : 答案 &= " " & 百位(0) ElseIf CInt(位數(8) & 位數(9) & 末位數) >= 200 Then : 答案 &= " " & 個位(位數(8)) & " " & 百位(1) : End If '------------------個十------------------------------------------------------------------------------------------------------ If 位數(9) = "0" And 末位數 = "0" Then ElseIf 位數(9) = "0" And 末位數 <> "0" Then : 答案 &= " " & 個位(末位數) Else If CInt(位數(9) & 末位數) < 21 Then If 末位數 = "0" Then : 答案 &= " " & 十位(位數(9)) : Else : 答案 &= " " & 個位(位數(9) & 末位數) : End If Else If 位數(9) <> "0" And 末位數 = "0" Then : 答案 &= " " & 十位(位數(9)) ElseIf 位數(9) <> "0" And 末位數 <> "0" Then : 答案 &= " " & 十位(位數(9)) & " " & 個位(末位數) : End If End If End If ElseIf 數長 = 11 Then '------------------十十億(百億)------------------------------------------------------------------------------------------------------ If CInt(位數(1) & 位數(2)) < 21 Then If 位數(2) = "0" Then : 答案 = 十位(位數(1)) & " " & 十億 : Else : 答案 = 個位(位數(1) & 位數(2)) & " " & 十億 : End If Else If 位數(1) <> "0" And 位數(2) = "0" Then : 答案 = 十位(位數(1)) & " " & 十億 ElseIf 位數(1) <> "0" And 位數(2) <> "0" Then : 答案 = 十位(位數(1)) & " " & 個位(位數(2)) & " " & 十億 : End If End If '------------------百百萬(億)------------------------------------------------------------------------------------------------------ If CInt(位數(3)) = 0 Then ElseIf CInt(位數(3)) = 1 Then : 答案 &= " " & 百位(0) ElseIf CInt(位數(3)) > 1 Then : 答案 &= " " & 個位(位數(3)) & " " & 百位(1) : End If '------------------十百萬(千萬)------------------------------------------------------------------------------------------------------ If 位數(3) = "0" And 位數(4) = "0" And 位數(5) = "0" Then ElseIf 位數(4) = "0" And 位數(5) = "0" Then : 答案 &= " " & 百萬 ElseIf 位數(4) = "0" And 位數(5) <> "0" Then : 答案 &= " " & 個位(位數(5)) & " " & 百萬 ElseIf CInt(位數(4) & 位數(5)) < 21 Then If 位數(5) = "0" Then : 答案 &= " " & 十位(位數(4)) & " " & 百萬 : Else : 答案 &= " " & 個位(位數(4) & 位數(5)) & " " & 百萬 : End If ElseIf CInt(位數(4) & 位數(5)) >= 21 Then If 位數(4) <> "0" And 位數(5) = "0" Then : 答案 &= " " & 十位(位數(4)) & " " & 百萬 ElseIf 位數(4) <> "0" And 位數(5) <> "0" Then : 答案 &= " " & 十位(位數(4)) & " " & 個位(位數(5)) & " " & 百萬 : End If End If '------------------百千(十萬)------------------------------------------------------------------------------------------------------ If CInt(位數(6)) = 0 Then : ElseIf CInt(位數(6)) = 1 Then : 答案 &= " " & 百位(0) ElseIf CInt(位數(6)) > 1 Then : 答案 &= " " & 個位(位數(6)) & " " & 百位(1) : End If '------------------十千(萬)------------------------------------------------------------------------------------------------------ If CInt(位數(7) & 位數(8)) < 21 Then If 位數(6) = "0" And 位數(7) = "0" And 位數(8) = "0" Then ElseIf 位數(7) = "0" And 位數(8) = "0" Then : 答案 &= " " & 千位(1) ElseIf 位數(7) = "0" And 位數(8) <> "0" Then : 答案 &= " " & 個位(位數(8)) & " " & 千位(1) ElseIf 位數(7) <> "0" And 位數(8) = "0" Then : 答案 &= " " & 十位(位數(7)) & " " & 千位(1) ElseIf 位數(7) <> "0" And 位數(8) <> "0" Then : 答案 &= " " & 個位(位數(7) & 位數(8)) & " " & 千位(1) : End If Else If 位數(7) <> "0" And 位數(8) = "0" Then : 答案 &= " " & 十位(位數(7)) & " " & 千位(1) ElseIf 位數(7) <> "0" And 位數(8) <> "0" Then : 答案 &= " " & 十位(位數(7)) & " " & 個位(位數(8)) & " " & 千位(1) : End If End If '------------------百------------------------------------------------------------------------------------------------------ If CInt(位數(9) & 位數(10) & 末位數) < 100 Then ElseIf CInt(位數(9) & 位數(10) & 末位數) < 200 Then : 答案 &= " " & 百位(0) ElseIf CInt(位數(9) & 位數(10) & 末位數) >= 200 Then : 答案 &= " " & 個位(位數(9)) & " " & 百位(1) : End If '------------------個十------------------------------------------------------------------------------------------------------ If 位數(10) = "0" And 末位數 = "0" Then ElseIf 位數(10) = "0" And 末位數 <> "0" Then : 答案 &= " " & 個位(末位數) Else If CInt(位數(10) & 末位數) < 21 Then If 末位數 = "0" Then : 答案 &= " " & 十位(位數(10)) : Else : 答案 &= " " & 個位(位數(10) & 末位數) : End If Else If 位數(10) <> "0" And 末位數 = "0" Then : 答案 &= " " & 十位(位數(10)) ElseIf 位數(10) <> "0" And 末位數 <> "0" Then : 答案 &= " " & 十位(位數(10)) & " " & 個位(末位數) : End If End If End If ElseIf 數長 = 12 Then '------------------百(千億)------------------------------------------------------------------------------------------------------ If 位數(1) = "1" Then : 答案 = 百位(0) : ElseIf 位數(1) <> "1" Then : 答案 = 個位(位數(1)) & " " & 百位(1) : End If '------------------十十億(百億)------------------------------------------------------------------------------------------------------ If 位數(2) = "0" And 位數(3) = "0" Then : 答案 &= " " & 十億 ElseIf CInt(位數(2) & 位數(3)) < 21 Then If 位數(3) = "0" Then : 答案 &= " " & 十位(位數(2)) & " " & 十億 : Else : 答案 &= " " & 個位(位數(2) & 位數(3)) & " " & 十億 : End If Else If 位數(2) <> "0" And 位數(3) = "0" Then : 答案 &= " " & 十位(位數(2)) & " " & 十億 ElseIf 位數(2) <> "0" And 位數(3) <> "0" Then : 答案 &= " " & 十位(位數(2)) & " " & 個位(位數(3)) & " " & 十億 : End If End If '------------------百百萬(億)------------------------------------------------------------------------------------------------------ If CInt(位數(4)) = 0 Then ElseIf CInt(位數(4)) = 1 Then : 答案 &= " " & 百位(0) ElseIf CInt(位數(4)) > 1 Then : 答案 &= " " & 個位(位數(4)) & " " & 百位(1) : End If '------------------十百萬(千萬)------------------------------------------------------------------------------------------------------ If 位數(4) = "0" And 位數(5) = "0" And 位數(6) = "0" Then ElseIf 位數(5) = "0" And 位數(6) = "0" Then : 答案 &= " " & 百萬 ElseIf 位數(5) = "0" And 位數(6) <> "0" Then : 答案 &= " " & 個位(位數(6)) & " " & 百萬 ElseIf CInt(位數(5) & 位數(6)) < 21 Then If 位數(6) = "0" Then : 答案 &= " " & 十位(位數(5)) & " " & 百萬 : Else : 答案 &= " " & 個位(位數(5) & 位數(6)) & " " & 百萬 : End If ElseIf CInt(位數(5) & 位數(6)) >= 21 Then If 位數(5) <> "0" And 位數(6) = "0" Then : 答案 &= " " & 十位(位數(5)) & " " & 百萬 ElseIf 位數(5) <> "0" And 位數(6) <> "0" Then : 答案 &= " " & 十位(位數(5)) & " " & 個位(位數(6)) & " " & 百萬 : End If End If '------------------百千(十萬)------------------------------------------------------------------------------------------------------ If CInt(位數(7)) = 0 Then : ElseIf CInt(位數(7)) = 1 Then : 答案 &= " " & 百位(0) ElseIf CInt(位數(7)) > 1 Then : 答案 &= " " & 個位(位數(7)) & " " & 百位(1) : End If '------------------十千(萬)------------------------------------------------------------------------------------------------------ If CInt(位數(8) & 位數(9)) < 21 Then If 位數(7) = "0" And 位數(8) = "0" And 位數(9) = "0" Then ElseIf 位數(8) = "0" And 位數(9) = "0" Then : 答案 &= " " & 千位(1) ElseIf 位數(8) = "0" And 位數(9) <> "0" Then : 答案 &= " " & 個位(位數(9)) & " " & 千位(1) ElseIf 位數(8) <> "0" And 位數(9) = "0" Then : 答案 &= " " & 十位(位數(8)) & " " & 千位(1) ElseIf 位數(8) <> "0" And 位數(9) <> "0" Then : 答案 &= " " & 個位(位數(8) & 位數(9)) & " " & 千位(1) : End If Else If 位數(8) <> "0" And 位數(9) = "0" Then : 答案 &= " " & 十位(位數(8)) & " " & 千位(1) ElseIf 位數(8) <> "0" And 位數(9) <> "0" Then : 答案 &= " " & 十位(位數(8)) & " " & 個位(位數(9)) & " " & 千位(1) : End If End If '------------------百------------------------------------------------------------------------------------------------------ If CInt(位數(10) & 位數(11) & 末位數) < 100 Then ElseIf CInt(位數(10) & 位數(11) & 末位數) < 200 Then : 答案 &= " " & 百位(0) ElseIf CInt(位數(10) & 位數(11) & 末位數) >= 200 Then : 答案 &= " " & 個位(位數(10)) & " " & 百位(1) : End If '------------------個十------------------------------------------------------------------------------------------------------ If 位數(11) = "0" And 末位數 = "0" Then ElseIf 位數(11) = "0" And 末位數 <> "0" Then : 答案 &= " " & 個位(末位數) Else If CInt(位數(11) & 末位數) < 21 Then If 末位數 = "0" Then : 答案 &= " " & 十位(位數(11)) : Else : 答案 &= " " & 個位(位數(11) & 末位數) : End If Else If 位數(11) <> "0" And 末位數 = "0" Then : 答案 &= " " & 十位(位數(11)) ElseIf 位數(11) <> "0" And 末位數 <> "0" Then : 答案 &= " " & 十位(位數(11)) & " " & 個位(末位數) : End If End If End If ElseIf 數長 = 13 Then '------------------兆------------------------------------------------------------------------------------------------------ 答案 = 個位(位數(1)) & " " & 兆 '------------------百(千億)------------------------------------------------------------------------------------------------------ If 位數(2) = "0" Then ElseIf 位數(2) = "1" Then : 答案 &= " " & 百位(0) ElseIf 位數(2) <> "1" Then : 答案 &= " " & 個位(位數(2)) & " " & 百位(1) : End If '------------------十十億(百億)------------------------------------------------------------------------------------------------------ If 位數(2) = "0" And 位數(3) = "0" And 位數(4) = "0" Then ElseIf 位數(3) = "0" And 位數(4) = "0" Then : 答案 &= " " & 十億 ElseIf CInt(位數(3) & 位數(4)) < 21 Then If 位數(4) = "0" Then : 答案 &= " " & 十位(位數(3)) & " " & 十億 : Else : 答案 &= " " & 個位(位數(3) & 位數(4)) & " " & 十億 : End If Else If 位數(3) <> "0" And 位數(4) = "0" Then : 答案 &= " " & 十位(位數(3)) & " " & 十億 ElseIf 位數(3) <> "0" And 位數(4) <> "0" Then : 答案 &= " " & 十位(位數(3)) & " " & 個位(位數(4)) & " " & 十億 : End If End If '------------------百百萬(億)------------------------------------------------------------------------------------------------------ If CInt(位數(5)) = 0 Then ElseIf CInt(位數(5)) = 1 Then : 答案 &= " " & 百位(0) ElseIf CInt(位數(5)) > 1 Then : 答案 &= " " & 個位(位數(5)) & " " & 百位(1) : End If '------------------十百萬(千萬)------------------------------------------------------------------------------------------------------ If 位數(5) = "0" And 位數(6) = "0" And 位數(7) = "0" Then ElseIf 位數(6) = "0" And 位數(7) = "0" Then : 答案 &= " " & 百萬 ElseIf 位數(6) = "0" And 位數(7) <> "0" Then : 答案 &= " " & 個位(位數(7)) & " " & 百萬 ElseIf CInt(位數(6) & 位數(7)) < 21 Then If 位數(7) = "0" Then : 答案 &= " " & 十位(位數(6)) & " " & 百萬 : Else : 答案 &= " " & 個位(位數(6) & 位數(7)) & " " & 百萬 : End If ElseIf CInt(位數(6) & 位數(7)) >= 21 Then If 位數(6) <> "0" And 位數(7) = "0" Then : 答案 &= " " & 十位(位數(6)) & " " & 百萬 ElseIf 位數(6) <> "0" And 位數(7) <> "0" Then : 答案 &= " " & 十位(位數(6)) & " " & 個位(位數(7)) & " " & 百萬 : End If End If '------------------百千(十萬)------------------------------------------------------------------------------------------------------ If CInt(位數(8)) = 0 Then : ElseIf CInt(位數(8)) = 1 Then : 答案 &= " " & 百位(0) ElseIf CInt(位數(8)) > 1 Then : 答案 &= " " & 個位(位數(8)) & " " & 百位(1) : End If '------------------十千(萬)------------------------------------------------------------------------------------------------------ If CInt(位數(9) & 位數(10)) < 21 Then If 位數(8) = "0" And 位數(9) = "0" And 位數(10) = "0" Then ElseIf 位數(9) = "0" And 位數(10) = "0" Then : 答案 &= " " & 千位(1) ElseIf 位數(9) = "0" And 位數(10) <> "0" Then : 答案 &= " " & 個位(位數(10)) & " " & 千位(1) ElseIf 位數(9) <> "0" And 位數(10) = "0" Then : 答案 &= " " & 十位(位數(9)) & " " & 千位(1) ElseIf 位數(9) <> "0" And 位數(10) <> "0" Then : 答案 &= " " & 個位(位數(9) & 位數(10)) & " " & 千位(1) : End If Else If 位數(9) <> "0" And 位數(10) = "0" Then : 答案 &= " " & 十位(位數(9)) & " " & 千位(1) ElseIf 位數(9) <> "0" And 位數(10) <> "0" Then : 答案 &= " " & 十位(位數(9)) & " " & 個位(位數(10)) & " " & 千位(1) : End If End If '------------------百------------------------------------------------------------------------------------------------------ If CInt(位數(11) & 位數(12) & 末位數) < 100 Then ElseIf CInt(位數(11) & 位數(12) & 末位數) < 200 Then : 答案 &= " " & 百位(0) ElseIf CInt(位數(11) & 位數(12) & 末位數) >= 200 Then : 答案 &= " " & 個位(位數(11)) & " " & 百位(1) : End If '------------------個十------------------------------------------------------------------------------------------------------ If 位數(12) = "0" And 末位數 = "0" Then ElseIf 位數(12) = "0" And 末位數 <> "0" Then : 答案 &= " " & 個位(末位數) Else If CInt(位數(12) & 末位數) < 21 Then If 末位數 = "0" Then : 答案 &= " " & 十位(位數(12)) : Else : 答案 &= " " & 個位(位數(12) & 末位數) : End If Else If 位數(12) <> "0" And 末位數 = "0" Then : 答案 &= " " & 十位(位數(12)) ElseIf 位數(12) <> "0" And 末位數 <> "0" Then : 答案 &= " " & 十位(位數(12)) & " " & 個位(末位數) : End If End If End If ElseIf 數長 = 14 Then '------------------十兆------------------------------------------------------------------------------------------------------ If CInt(位數(1) & 位數(2)) < 21 Then If 位數(2) = "0" Then : 答案 = 十位(位數(1)) & " " & 兆 : Else : 答案 = 個位(位數(1) & 位數(2)) & " " & 兆 : End If Else If 位數(1) <> "0" And 位數(2) = "0" Then : 答案 = 十位(位數(1)) & " " & 兆 ElseIf 位數(1) <> "0" And 位數(2) <> "0" Then : 答案 = 十位(位數(1)) & " " & 個位(位數(2)) & " " & 兆 : End If End If '------------------百(千億)------------------------------------------------------------------------------------------------------ If 位數(3) = "0" Then ElseIf 位數(3) = "1" Then : 答案 &= " " & 百位(0) ElseIf 位數(3) <> "1" Then : 答案 &= " " & 個位(位數(3)) & " " & 百位(1) : End If '------------------十十億(百億)------------------------------------------------------------------------------------------------------ If 位數(3) = "0" And 位數(4) = "0" And 位數(5) = "0" Then ElseIf 位數(4) = "0" And 位數(5) = "0" Then : 答案 &= " " & 十億 ElseIf CInt(位數(4) & 位數(5)) < 21 Then If 位數(5) = "0" Then : 答案 &= " " & 十位(位數(4)) & " " & 十億 : Else : 答案 &= " " & 個位(位數(4) & 位數(5)) & " " & 十億 : End If Else If 位數(4) <> "0" And 位數(5) = "0" Then : 答案 &= " " & 十位(位數(4)) & " " & 十億 ElseIf 位數(4) <> "0" And 位數(5) <> "0" Then : 答案 &= " " & 十位(位數(4)) & " " & 個位(位數(5)) & " " & 十億 : End If End If '------------------百百萬(億)------------------------------------------------------------------------------------------------------ If CInt(位數(6)) = 0 Then ElseIf CInt(位數(6)) = 1 Then : 答案 &= " " & 百位(0) ElseIf CInt(位數(6)) > 1 Then : 答案 &= " " & 個位(位數(6)) & " " & 百位(1) : End If '------------------十百萬(千萬)------------------------------------------------------------------------------------------------------ If 位數(6) = "0" And 位數(7) = "0" And 位數(8) = "0" Then ElseIf 位數(7) = "0" And 位數(8) = "0" Then : 答案 &= " " & 百萬 ElseIf 位數(7) = "0" And 位數(8) <> "0" Then : 答案 &= " " & 個位(位數(8)) & " " & 百萬 ElseIf CInt(位數(7) & 位數(8)) < 21 Then If 位數(8) = "0" Then : 答案 &= " " & 十位(位數(7)) & " " & 百萬 : Else : 答案 &= " " & 個位(位數(7) & 位數(8)) & " " & 百萬 : End If ElseIf CInt(位數(7) & 位數(8)) >= 21 Then If 位數(7) <> "0" And 位數(8) = "0" Then : 答案 &= " " & 十位(位數(7)) & " " & 百萬 ElseIf 位數(7) <> "0" And 位數(8) <> "0" Then : 答案 &= " " & 十位(位數(7)) & " " & 個位(位數(8)) & " " & 百萬 : End If End If '------------------百千(十萬)------------------------------------------------------------------------------------------------------ If CInt(位數(9)) = 0 Then : ElseIf CInt(位數(9)) = 1 Then : 答案 &= " " & 百位(0) ElseIf CInt(位數(9)) > 1 Then : 答案 &= " " & 個位(位數(9)) & " " & 百位(1) : End If '------------------十千(萬)------------------------------------------------------------------------------------------------------ If CInt(位數(10) & 位數(11)) < 21 Then If 位數(9) = "0" And 位數(10) = "0" And 位數(11) = "0" Then ElseIf 位數(10) = "0" And 位數(11) = "0" Then : 答案 &= " " & 千位(1) ElseIf 位數(10) = "0" And 位數(11) <> "0" Then : 答案 &= " " & 個位(位數(11)) & " " & 千位(1) ElseIf 位數(10) <> "0" And 位數(11) = "0" Then : 答案 &= " " & 十位(位數(10)) & " " & 千位(1) ElseIf 位數(10) <> "0" And 位數(11) <> "0" Then : 答案 &= " " & 個位(位數(10) & 位數(11)) & " " & 千位(1) : End If Else If 位數(10) <> "0" And 位數(11) = "0" Then : 答案 &= " " & 十位(位數(10)) & " " & 千位(1) ElseIf 位數(10) <> "0" And 位數(11) <> "0" Then : 答案 &= " " & 十位(位數(10)) & " " & 個位(位數(11)) & " " & 千位(1) : End If End If '------------------百------------------------------------------------------------------------------------------------------ If CInt(位數(12) & 位數(13) & 末位數) < 100 Then ElseIf CInt(位數(12) & 位數(13) & 末位數) < 200 Then : 答案 &= " " & 百位(0) ElseIf CInt(位數(12) & 位數(13) & 末位數) >= 200 Then : 答案 &= " " & 個位(位數(12)) & " " & 百位(1) : End If '------------------個十------------------------------------------------------------------------------------------------------ If 位數(13) = "0" And 末位數 = "0" Then ElseIf 位數(13) = "0" And 末位數 <> "0" Then : 答案 &= " " & 個位(末位數) Else If CInt(位數(13) & 末位數) < 21 Then If 末位數 = "0" Then : 答案 &= " " & 十位(位數(13)) : Else : 答案 &= " " & 個位(位數(13) & 末位數) : End If Else If 位數(13) <> "0" And 末位數 = "0" Then : 答案 &= " " & 十位(位數(13)) ElseIf 位數(13) <> "0" And 末位數 <> "0" Then : 答案 &= " " & 十位(位數(13)) & " " & 個位(末位數) End If End If End If End If Else If 數長 = 1 Then : 答案 = 個位(申請金額_nud.Value) ElseIf 數長 = 2 Then If 末位數 = "0" Then : 答案 = 個位(位數(1)) & 拾 : Else : 答案 = 個位(位數(1)) & 拾 & 個位(末位數) : End If ElseIf 數長 = 3 Then : 答案 = 個位(位數(1)) & 百 If 位數(2) = "0" And 末位數 = "0" Then ElseIf 位數(2) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(末位數) ElseIf 位數(2) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(2)) & 拾 ElseIf 位數(2) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(2)) & 拾 & 個位(末位數) End If ElseIf 數長 = 4 Then : 答案 = 個位(位數(1)) & 仟 If 位數(2) = "0" And 位數(3) = "0" And 末位數 = "0" Then ElseIf 位數(2) = "0" And 位數(3) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(末位數) ElseIf 位數(2) = "0" And 位數(3) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(3)) & 拾 & 個位(末位數) ElseIf 位數(2) = "0" And 位數(3) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(3)) & 拾 ElseIf 位數(2) <> "0" And 位數(3) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(2)) & 百 ElseIf 位數(2) <> "0" And 位數(3) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(2)) & 百 & 零 & 個位(末位數) ElseIf 位數(2) <> "0" And 位數(3) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(2)) & 百 & 個位(位數(3)) & 拾 ElseIf 位數(2) <> "0" And 末位數 <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(2)) & 百 & 個位(位數(3)) & 拾 & 個位(末位數) End If ElseIf 數長 = 5 Then : 答案 = 個位(位數(1)) & 萬 If 位數(2) = "0" And 位數(3) = "0" And 位數(4) = "0" And 末位數 = "0" Then ElseIf 位數(2) = "0" And 位數(3) = "0" And 位數(4) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(末位數) ElseIf 位數(2) = "0" And 位數(3) = "0" And 位數(4) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(4)) & 拾 ElseIf 位數(2) = "0" And 位數(3) = "0" And 位數(4) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(4)) & 拾 & 個位(末位數) ElseIf 位數(2) = "0" And 位數(3) <> "0" And 位數(4) = "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(3)) & 百 ElseIf 位數(2) = "0" And 位數(3) <> "0" And 位數(4) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(3)) & 百 & 零 & 個位(末位數) ElseIf 位數(2) = "0" And 位數(3) <> "0" And 位數(4) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(3)) & 百 & 個位(位數(4)) & 拾 ElseIf 位數(2) = "0" And 位數(3) <> "0" And 位數(4) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(3)) & 百 & 個位(位數(4)) & 拾 & 個位(末位數) ElseIf 位數(2) <> "0" And 位數(3) = "0" And 位數(4) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(2)) & 仟 ElseIf 位數(2) <> "0" And 位數(3) = "0" And 位數(4) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(2)) & 仟 & 零 & 個位(末位數) ElseIf 位數(2) <> "0" And 位數(3) = "0" And 位數(4) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(2)) & 仟 & 零 & 個位(位數(4)) & 拾 ElseIf 位數(2) <> "0" And 位數(3) = "0" And 位數(4) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(2)) & 仟 & 零 & 個位(位數(4)) & 拾 & 個位(末位數) ElseIf 位數(2) <> "0" And 位數(3) <> "0" And 位數(4) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(2)) & 仟 & 個位(位數(3)) & 百 ElseIf 位數(2) <> "0" And 位數(3) <> "0" And 位數(4) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(2)) & 仟 & 個位(位數(3)) & 百 & 零 & 個位(末位數) ElseIf 位數(2) <> "0" And 位數(3) <> "0" And 位數(4) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(2)) & 仟 & 個位(位數(3)) & 百 & 個位(位數(4)) & 拾 ElseIf 位數(2) <> "0" And 位數(3) <> "0" And 位數(4) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(2)) & 仟 & 個位(位數(3)) & 百 & 個位(位數(4)) & 拾 & 個位(末位數) End If ElseIf 數長 = 6 Then If 位數(2) = "0" Then : 答案 = 個位(位數(1)) & 拾 & 萬 : Else : 答案 = 個位(位數(1)) & 拾 & 個位(位數(2)) & 萬 : End If If 位數(3) = "0" And 位數(4) = "0" And 位數(5) = "0" And 末位數 = "0" Then ElseIf 位數(3) = "0" And 位數(4) = "0" And 位數(5) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(末位數) ElseIf 位數(3) = "0" And 位數(4) = "0" And 位數(5) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(5)) & 拾 ElseIf 位數(3) = "0" And 位數(4) = "0" And 位數(5) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(5)) & 拾 & 個位(末位數) ElseIf 位數(3) = "0" And 位數(4) <> "0" And 位數(5) = "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(4)) & 百 ElseIf 位數(3) = "0" And 位數(4) <> "0" And 位數(5) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(4)) & 百 & 零 & 個位(末位數) ElseIf 位數(3) = "0" And 位數(4) <> "0" And 位數(5) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(4)) & 百 & 個位(位數(5)) & 拾 ElseIf 位數(3) = "0" And 位數(4) <> "0" And 位數(5) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(4)) & 百 & 個位(位數(5)) & 拾 & 個位(末位數) ElseIf 位數(3) <> "0" And 位數(4) = "0" And 位數(5) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(3)) & 仟 ElseIf 位數(3) <> "0" And 位數(4) = "0" And 位數(5) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(3)) & 仟 & 零 & 個位(末位數) ElseIf 位數(3) <> "0" And 位數(4) = "0" And 位數(5) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(3)) & 仟 & 零 & 個位(位數(5)) & 拾 ElseIf 位數(3) <> "0" And 位數(4) = "0" And 位數(5) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(3)) & 仟 & 零 & 個位(位數(5)) & 拾 & 個位(末位數) ElseIf 位數(3) <> "0" And 位數(4) <> "0" And 位數(5) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(3)) & 仟 & 個位(位數(4)) & 百 ElseIf 位數(3) <> "0" And 位數(4) <> "0" And 位數(5) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(3)) & 仟 & 個位(位數(4)) & 百 & 零 & 個位(末位數) ElseIf 位數(3) <> "0" And 位數(4) <> "0" And 位數(5) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(3)) & 仟 & 個位(位數(4)) & 百 & 個位(位數(5)) & 拾 ElseIf 位數(3) <> "0" And 位數(4) <> "0" And 位數(5) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(3)) & 仟 & 個位(位數(4)) & 百 & 個位(位數(5)) & 拾 & 個位(末位數) End If ElseIf 數長 = 7 Then : 答案 = 個位(位數(1)) & 百 If 位數(2) = "0" And 位數(3) = "0" Then : 答案 &= 萬 ElseIf 位數(2) = "0" And 位數(3) <> "0" Then : 答案 &= 零 & 個位(位數(3)) & 萬 ElseIf 位數(2) <> "0" And 位數(3) = "0" Then : 答案 &= 個位(位數(2)) & 拾 & 萬 ElseIf 位數(2) <> "0" And 位數(3) <> "0" Then : 答案 &= 個位(位數(2)) & 拾 & 個位(位數(3)) & 萬 End If If 位數(4) = "0" And 位數(5) = "0" And 位數(6) = "0" And 末位數 = "0" Then ElseIf 位數(4) = "0" And 位數(5) = "0" And 位數(6) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(末位數) ElseIf 位數(4) = "0" And 位數(5) = "0" And 位數(6) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(6)) & 拾 ElseIf 位數(4) = "0" And 位數(5) = "0" And 位數(6) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(6)) & 拾 & 個位(末位數) ElseIf 位數(4) = "0" And 位數(5) <> "0" And 位數(6) = "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(5)) & 百 ElseIf 位數(4) = "0" And 位數(5) <> "0" And 位數(6) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(5)) & 百 & 零 & 個位(末位數) ElseIf 位數(4) = "0" And 位數(5) <> "0" And 位數(6) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(5)) & 百 & 個位(位數(6)) & 拾 ElseIf 位數(4) = "0" And 位數(5) <> "0" And 位數(6) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(5)) & 百 & 個位(位數(6)) & 拾 & 個位(末位數) ElseIf 位數(4) <> "0" And 位數(5) = "0" And 位數(6) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(4)) & 仟 ElseIf 位數(4) <> "0" And 位數(5) = "0" And 位數(6) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(4)) & 仟 & 零 & 個位(末位數) ElseIf 位數(4) <> "0" And 位數(5) = "0" And 位數(6) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(4)) & 仟 & 零 & 個位(位數(6)) & 拾 ElseIf 位數(4) <> "0" And 位數(5) = "0" And 位數(6) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(4)) & 仟 & 零 & 個位(位數(6)) & 拾 & 個位(末位數) ElseIf 位數(4) <> "0" And 位數(5) <> "0" And 位數(6) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(4)) & 仟 & 個位(位數(5)) & 百 ElseIf 位數(4) <> "0" And 位數(5) <> "0" And 位數(6) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(4)) & 仟 & 個位(位數(5)) & 百 & 零 & 個位(末位數) ElseIf 位數(4) <> "0" And 位數(5) <> "0" And 位數(6) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(4)) & 仟 & 個位(位數(5)) & 百 & 個位(位數(6)) & 拾 ElseIf 位數(4) <> "0" And 位數(5) <> "0" And 位數(6) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(4)) & 仟 & 個位(位數(5)) & 百 & 個位(位數(6)) & 拾 & 個位(末位數) End If ElseIf 數長 = 8 Then : 答案 = 個位(位數(1)) & 仟 If 位數(2) = "0" And 位數(3) = "0" And 位數(4) = "0" Then : 答案 &= 萬 ElseIf 位數(2) = "0" And 位數(3) = "0" And 位數(4) <> "0" Then : 答案 &= 零 & 個位(位數(4)) & 萬 ElseIf 位數(2) = "0" And 位數(3) <> "0" And 位數(4) <> "0" Then : 答案 &= 零 & 個位(位數(3)) & 拾 & 個位(位數(4)) & 萬 ElseIf 位數(2) = "0" And 位數(3) <> "0" And 位數(4) = "0" Then : 答案 &= 零 & 個位(位數(3)) & 拾 & 萬 ElseIf 位數(2) <> "0" And 位數(3) = "0" And 位數(4) = "0" Then : 答案 &= 個位(位數(2)) & 百 & 萬 ElseIf 位數(2) <> "0" And 位數(3) = "0" And 位數(4) <> "0" Then : 答案 &= 個位(位數(2)) & 百 & 零 & 個位(位數(4)) & 萬 ElseIf 位數(2) <> "0" And 位數(3) <> "0" And 位數(4) = "0" Then : 答案 &= 個位(位數(2)) & 百 & 個位(位數(3)) & 拾 & 萬 ElseIf 位數(2) <> "0" And 位數(4) <> "0" And 位數(4) <> "0" Then : 答案 &= 個位(位數(2)) & 百 & 個位(位數(3)) & 拾 & 個位(位數(4)) & 萬 End If If 位數(5) = "0" And 位數(6) = "0" And 位數(7) = "0" And 末位數 = "0" Then ElseIf 位數(5) = "0" And 位數(6) = "0" And 位數(7) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(末位數) ElseIf 位數(5) = "0" And 位數(6) = "0" And 位數(7) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(7)) & 拾 ElseIf 位數(5) = "0" And 位數(6) = "0" And 位數(7) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(7)) & 拾 & 個位(末位數) ElseIf 位數(5) = "0" And 位數(6) <> "0" And 位數(7) = "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(6)) & 百 ElseIf 位數(5) = "0" And 位數(6) <> "0" And 位數(7) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(6)) & 百 & 零 & 個位(末位數) ElseIf 位數(5) = "0" And 位數(6) <> "0" And 位數(7) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(6)) & 百 & 個位(位數(7)) & 拾 ElseIf 位數(5) = "0" And 位數(6) <> "0" And 位數(7) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(6)) & 百 & 個位(位數(7)) & 拾 & 個位(末位數) ElseIf 位數(5) <> "0" And 位數(6) = "0" And 位數(7) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(5)) & 仟 ElseIf 位數(5) <> "0" And 位數(6) = "0" And 位數(7) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(5)) & 仟 & 零 & 個位(末位數) ElseIf 位數(5) <> "0" And 位數(6) = "0" And 位數(7) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(5)) & 仟 & 零 & 個位(位數(7)) & 拾 ElseIf 位數(5) <> "0" And 位數(6) = "0" And 位數(7) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(5)) & 仟 & 零 & 個位(位數(7)) & 拾 & 個位(末位數) ElseIf 位數(5) <> "0" And 位數(6) <> "0" And 位數(7) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(5)) & 仟 & 個位(位數(6)) & 百 ElseIf 位數(5) <> "0" And 位數(6) <> "0" And 位數(7) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(5)) & 仟 & 個位(位數(6)) & 百 & 零 & 個位(末位數) ElseIf 位數(5) <> "0" And 位數(6) <> "0" And 位數(7) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(5)) & 仟 & 個位(位數(6)) & 百 & 個位(位數(7)) & 拾 ElseIf 位數(5) <> "0" And 位數(6) <> "0" And 位數(7) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(5)) & 仟 & 個位(位數(6)) & 百 & 個位(位數(7)) & 拾 & 個位(末位數) End If ElseIf 數長 = 9 Then : 答案 = 個位(位數(1)) & 億 If 位數(2) = "0" And 位數(3) = "0" And 位數(4) = "0" And 位數(5) = "0" Then ElseIf 位數(2) = "0" And 位數(3) = "0" And 位數(4) = "0" And 位數(5) <> "0" Then : 答案 &= 零 & 個位(位數(5)) & 萬 ElseIf 位數(2) = "0" And 位數(3) = "0" And 位數(4) <> "0" And 位數(5) = "0" Then : 答案 &= 零 & 個位(位數(4)) & 拾 & 萬 ElseIf 位數(2) = "0" And 位數(3) = "0" And 位數(4) <> "0" And 位數(5) <> "0" Then : 答案 &= 零 & 個位(位數(4)) & 拾 & 個位(位數(5)) & 萬 ElseIf 位數(2) = "0" And 位數(3) <> "0" And 位數(4) = "0" And 位數(5) = "0" Then : 答案 &= 零 & 個位(位數(3)) & 百 & 萬 ElseIf 位數(2) = "0" And 位數(3) <> "0" And 位數(4) = "0" And 位數(5) <> "0" Then : 答案 &= 零 & 個位(位數(3)) & 百 & 零 & 個位(位數(5)) & 萬 ElseIf 位數(2) = "0" And 位數(3) <> "0" And 位數(4) <> "0" And 位數(5) = "0" Then : 答案 &= 零 & 個位(位數(3)) & 百 & 個位(位數(4)) & 拾 & 萬 ElseIf 位數(2) = "0" And 位數(3) <> "0" And 位數(4) <> "0" And 位數(5) <> "0" Then : 答案 &= 零 & 個位(位數(3)) & 百 & 個位(位數(4)) & 拾 & 個位(位數(5)) & 萬 ElseIf 位數(2) <> "0" And 位數(3) = "0" And 位數(4) = "0" And 位數(5) = "0" Then : 答案 &= 個位(位數(2)) & 仟 & 萬 ElseIf 位數(2) <> "0" And 位數(3) = "0" And 位數(4) = "0" And 位數(5) <> "0" Then : 答案 &= 個位(位數(2)) & 仟 & 零 & 個位(位數(5)) & 萬 ElseIf 位數(2) <> "0" And 位數(3) = "0" And 位數(4) <> "0" And 位數(5) = "0" Then : 答案 &= 個位(位數(2)) & 仟 & 零 & 個位(位數(4)) & 拾 & 萬 ElseIf 位數(2) <> "0" And 位數(3) = "0" And 位數(4) <> "0" And 位數(5) <> "0" Then : 答案 &= 個位(位數(2)) & 仟 & 零 & 個位(位數(4)) & 拾 & 個位(位數(5)) & 萬 ElseIf 位數(2) <> "0" And 位數(3) <> "0" And 位數(4) = "0" And 位數(5) = "0" Then : 答案 &= 個位(位數(2)) & 仟 & 個位(位數(3)) & 百 & 萬 ElseIf 位數(2) <> "0" And 位數(3) <> "0" And 位數(4) = "0" And 位數(5) <> "0" Then : 答案 &= 個位(位數(2)) & 仟 & 個位(位數(3)) & 百 & 零 & 個位(位數(5)) & 萬 ElseIf 位數(2) <> "0" And 位數(3) <> "0" And 位數(4) <> "0" And 位數(5) = "0" Then : 答案 &= 個位(位數(2)) & 仟 & 個位(位數(3)) & 百 & 個位(位數(4)) & 拾 & 萬 ElseIf 位數(2) <> "0" And 位數(3) <> "0" And 位數(4) <> "0" And 位數(5) <> "0" Then : 答案 &= 個位(位數(2)) & 仟 & 個位(位數(3)) & 百 & 個位(位數(4)) & 拾 & 個位(位數(5)) & 萬 End If If 位數(6) = "0" And 位數(7) = "0" And 位數(8) = "0" And 末位數 = "0" Then ElseIf 位數(6) = "0" And 位數(7) = "0" And 位數(8) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(末位數) ElseIf 位數(6) = "0" And 位數(7) = "0" And 位數(8) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(8)) & 拾 ElseIf 位數(6) = "0" And 位數(7) = "0" And 位數(8) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(8)) & 拾 & 個位(末位數) ElseIf 位數(6) = "0" And 位數(7) <> "0" And 位數(8) = "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(7)) & 百 ElseIf 位數(6) = "0" And 位數(7) <> "0" And 位數(8) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(7)) & 百 & 零 & 個位(末位數) ElseIf 位數(6) = "0" And 位數(7) <> "0" And 位數(8) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(7)) & 百 & 個位(位數(8)) & 拾 ElseIf 位數(6) = "0" And 位數(7) <> "0" And 位數(8) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(7)) & 百 & 個位(位數(8)) & 拾 & 個位(末位數) ElseIf 位數(6) <> "0" And 位數(7) = "0" And 位數(8) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(6)) & 仟 ElseIf 位數(6) <> "0" And 位數(7) = "0" And 位數(8) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(6)) & 仟 & 零 & 個位(末位數) ElseIf 位數(6) <> "0" And 位數(7) = "0" And 位數(8) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(6)) & 仟 & 零 & 個位(位數(8)) & 拾 ElseIf 位數(6) <> "0" And 位數(7) = "0" And 位數(8) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(6)) & 仟 & 零 & 個位(位數(8)) & 拾 & 個位(末位數) ElseIf 位數(6) <> "0" And 位數(7) <> "0" And 位數(8) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(6)) & 仟 & 個位(位數(7)) & 百 ElseIf 位數(6) <> "0" And 位數(7) <> "0" And 位數(8) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(6)) & 仟 & 個位(位數(7)) & 百 & 零 & 個位(末位數) ElseIf 位數(6) <> "0" And 位數(7) <> "0" And 位數(8) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(6)) & 仟 & 個位(位數(7)) & 百 & 個位(位數(8)) & 拾 ElseIf 位數(6) <> "0" And 位數(7) <> "0" And 位數(8) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(6)) & 仟 & 個位(位數(7)) & 百 & 個位(位數(8)) & 拾 & 個位(末位數) End If ElseIf 數長 = 10 Then If 位數(2) = "0" Then : 答案 = 個位(位數(1)) & 拾 & 億 : Else : 答案 = 個位(位數(1)) & 拾 & 個位(位數(2)) & 億 : End If If 位數(3) = "0" And 位數(4) = "0" And 位數(5) = "0" And 位數(6) = "0" Then ElseIf 位數(3) = "0" And 位數(4) = "0" And 位數(5) = "0" And 位數(6) <> "0" Then : 答案 &= 零 & 個位(位數(6)) & 萬 ElseIf 位數(3) = "0" And 位數(4) = "0" And 位數(5) <> "0" And 位數(6) = "0" Then : 答案 &= 零 & 個位(位數(5)) & 拾 & 萬 ElseIf 位數(3) = "0" And 位數(4) = "0" And 位數(5) <> "0" And 位數(6) <> "0" Then : 答案 &= 零 & 個位(位數(5)) & 拾 & 個位(位數(6)) & 萬 ElseIf 位數(3) = "0" And 位數(4) <> "0" And 位數(5) = "0" And 位數(6) = "0" Then : 答案 &= 零 & 個位(位數(4)) & 百 & 萬 ElseIf 位數(3) = "0" And 位數(4) <> "0" And 位數(5) = "0" And 位數(6) <> "0" Then : 答案 &= 零 & 個位(位數(4)) & 百 & 零 & 個位(位數(6)) & 萬 ElseIf 位數(3) = "0" And 位數(4) <> "0" And 位數(5) <> "0" And 位數(6) = "0" Then : 答案 &= 零 & 個位(位數(4)) & 百 & 個位(位數(5)) & 拾 & 萬 ElseIf 位數(3) = "0" And 位數(4) <> "0" And 位數(5) <> "0" And 位數(6) <> "0" Then : 答案 &= 零 & 個位(位數(4)) & 百 & 個位(位數(5)) & 拾 & 個位(位數(6)) & 萬 ElseIf 位數(3) <> "0" And 位數(4) = "0" And 位數(5) = "0" And 位數(6) = "0" Then : 答案 &= 個位(位數(3)) & 仟 & 萬 ElseIf 位數(3) <> "0" And 位數(4) = "0" And 位數(5) = "0" And 位數(6) <> "0" Then : 答案 &= 個位(位數(3)) & 仟 & 零 & 個位(位數(6)) & 萬 ElseIf 位數(3) <> "0" And 位數(4) = "0" And 位數(5) <> "0" And 位數(6) = "0" Then : 答案 &= 個位(位數(3)) & 仟 & 零 & 個位(位數(5)) & 拾 & 萬 ElseIf 位數(3) <> "0" And 位數(4) = "0" And 位數(5) <> "0" And 位數(6) <> "0" Then : 答案 &= 個位(位數(3)) & 仟 & 零 & 個位(位數(5)) & 拾 & 個位(位數(6)) & 萬 ElseIf 位數(3) <> "0" And 位數(4) <> "0" And 位數(5) = "0" And 位數(6) = "0" Then : 答案 &= 個位(位數(3)) & 仟 & 個位(位數(4)) & 百 & 萬 ElseIf 位數(3) <> "0" And 位數(4) <> "0" And 位數(5) = "0" And 位數(6) <> "0" Then : 答案 &= 個位(位數(3)) & 仟 & 個位(位數(4)) & 百 & 零 & 個位(位數(6)) & 萬 ElseIf 位數(3) <> "0" And 位數(4) <> "0" And 位數(5) <> "0" And 位數(6) = "0" Then : 答案 &= 個位(位數(3)) & 仟 & 個位(位數(4)) & 百 & 個位(位數(5)) & 拾 & 萬 ElseIf 位數(3) <> "0" And 位數(4) <> "0" And 位數(5) <> "0" And 位數(6) <> "0" Then : 答案 &= 個位(位數(3)) & 仟 & 個位(位數(4)) & 百 & 個位(位數(5)) & 拾 & 個位(位數(6)) & 萬 End If If 位數(7) = "0" And 位數(8) = "0" And 位數(9) = "0" And 末位數 = "0" Then ElseIf 位數(7) = "0" And 位數(8) = "0" And 位數(9) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(末位數) ElseIf 位數(7) = "0" And 位數(8) = "0" And 位數(9) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(9)) & 拾 ElseIf 位數(7) = "0" And 位數(8) = "0" And 位數(9) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(9)) & 拾 & 個位(末位數) ElseIf 位數(7) = "0" And 位數(8) <> "0" And 位數(9) = "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(8)) & 百 ElseIf 位數(7) = "0" And 位數(8) <> "0" And 位數(9) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(8)) & 百 & 零 & 個位(末位數) ElseIf 位數(7) = "0" And 位數(8) <> "0" And 位數(9) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(8)) & 百 & 個位(位數(9)) & 拾 ElseIf 位數(7) = "0" And 位數(8) <> "0" And 位數(9) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(8)) & 百 & 個位(位數(9)) & 拾 & 個位(末位數) ElseIf 位數(7) <> "0" And 位數(8) = "0" And 位數(9) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(7)) & 仟 ElseIf 位數(7) <> "0" And 位數(8) = "0" And 位數(9) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(7)) & 仟 & 零 & 個位(末位數) ElseIf 位數(7) <> "0" And 位數(8) = "0" And 位數(9) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(7)) & 仟 & 零 & 個位(位數(9)) & 拾 ElseIf 位數(7) <> "0" And 位數(8) = "0" And 位數(9) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(7)) & 仟 & 零 & 個位(位數(9)) & 拾 & 個位(末位數) ElseIf 位數(7) <> "0" And 位數(8) <> "0" And 位數(9) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(7)) & 仟 & 個位(位數(8)) & 百 ElseIf 位數(7) <> "0" And 位數(8) <> "0" And 位數(9) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(7)) & 仟 & 個位(位數(8)) & 百 & 零 & 個位(末位數) ElseIf 位數(7) <> "0" And 位數(8) <> "0" And 位數(9) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(7)) & 仟 & 個位(位數(8)) & 百 & 個位(位數(9)) & 拾 ElseIf 位數(7) <> "0" And 位數(8) <> "0" And 位數(9) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(7)) & 仟 & 個位(位數(8)) & 百 & 個位(位數(9)) & 拾 & 個位(末位數) End If ElseIf 數長 = 11 Then : 答案 = 個位(位數(1)) & 百 If 位數(2) = "0" And 位數(3) = "0" Then : 答案 &= 億 ElseIf 位數(2) = "0" And 位數(3) <> "0" Then : 答案 &= 零 & 個位(位數(3)) & 億 ElseIf 位數(2) <> "0" And 位數(3) = "0" Then : 答案 &= 個位(位數(2)) & 拾 & 億 ElseIf 位數(2) <> "0" And 位數(3) <> "0" Then : 答案 &= 個位(位數(2)) & 拾 & 個位(位數(3)) & 億 End If If 位數(4) = "0" And 位數(5) = "0" And 位數(6) = "0" And 位數(7) = "0" Then ElseIf 位數(4) = "0" And 位數(5) = "0" And 位數(6) = "0" And 位數(7) <> "0" Then : 答案 &= 零 & 個位(位數(7)) & 萬 ElseIf 位數(4) = "0" And 位數(5) = "0" And 位數(6) <> "0" And 位數(7) = "0" Then : 答案 &= 零 & 個位(位數(6)) & 拾 & 萬 ElseIf 位數(4) = "0" And 位數(5) = "0" And 位數(6) <> "0" And 位數(7) <> "0" Then : 答案 &= 零 & 個位(位數(6)) & 拾 & 個位(位數(7)) & 萬 ElseIf 位數(4) = "0" And 位數(5) <> "0" And 位數(6) = "0" And 位數(7) = "0" Then : 答案 &= 零 & 個位(位數(5)) & 百 & 萬 ElseIf 位數(4) = "0" And 位數(5) <> "0" And 位數(6) = "0" And 位數(7) <> "0" Then : 答案 &= 零 & 個位(位數(5)) & 百 & 零 & 個位(位數(7)) & 萬 ElseIf 位數(4) = "0" And 位數(5) <> "0" And 位數(6) <> "0" And 位數(7) = "0" Then : 答案 &= 零 & 個位(位數(5)) & 百 & 個位(位數(6)) & 拾 & 萬 ElseIf 位數(4) = "0" And 位數(5) <> "0" And 位數(6) <> "0" And 位數(7) <> "0" Then : 答案 &= 零 & 個位(位數(5)) & 百 & 個位(位數(6)) & 拾 & 個位(位數(7)) & 萬 ElseIf 位數(4) <> "0" And 位數(5) = "0" And 位數(6) = "0" And 位數(7) = "0" Then : 答案 &= 個位(位數(4)) & 仟 & 萬 ElseIf 位數(4) <> "0" And 位數(5) = "0" And 位數(6) = "0" And 位數(7) <> "0" Then : 答案 &= 個位(位數(4)) & 仟 & 零 & 個位(位數(7)) & 萬 ElseIf 位數(4) <> "0" And 位數(5) = "0" And 位數(6) <> "0" And 位數(7) = "0" Then : 答案 &= 個位(位數(4)) & 仟 & 零 & 個位(位數(6)) & 拾 & 萬 ElseIf 位數(4) <> "0" And 位數(5) = "0" And 位數(6) <> "0" And 位數(7) <> "0" Then : 答案 &= 個位(位數(4)) & 仟 & 零 & 個位(位數(6)) & 拾 & 個位(位數(7)) & 萬 ElseIf 位數(4) <> "0" And 位數(5) <> "0" And 位數(6) = "0" And 位數(7) = "0" Then : 答案 &= 個位(位數(4)) & 仟 & 個位(位數(5)) & 百 & 萬 ElseIf 位數(4) <> "0" And 位數(5) <> "0" And 位數(6) = "0" And 位數(7) <> "0" Then : 答案 &= 個位(位數(4)) & 仟 & 個位(位數(5)) & 百 & 零 & 個位(位數(7)) & 萬 ElseIf 位數(4) <> "0" And 位數(5) <> "0" And 位數(6) <> "0" And 位數(7) = "0" Then : 答案 &= 個位(位數(4)) & 仟 & 個位(位數(5)) & 百 & 個位(位數(6)) & 拾 & 萬 ElseIf 位數(4) <> "0" And 位數(5) <> "0" And 位數(6) <> "0" And 位數(7) <> "0" Then : 答案 &= 個位(位數(4)) & 仟 & 個位(位數(5)) & 百 & 個位(位數(6)) & 拾 & 個位(位數(7)) & 萬 End If If 位數(8) = "0" And 位數(9) = "0" And 位數(10) = "0" And 末位數 = "0" Then ElseIf 位數(8) = "0" And 位數(9) = "0" And 位數(10) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(末位數) ElseIf 位數(8) = "0" And 位數(9) = "0" And 位數(10) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(10)) & 拾 ElseIf 位數(8) = "0" And 位數(9) = "0" And 位數(10) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(10)) & 拾 & 個位(末位數) ElseIf 位數(8) = "0" And 位數(9) <> "0" And 位數(10) = "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(9)) & 百 ElseIf 位數(8) = "0" And 位數(9) <> "0" And 位數(10) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(9)) & 百 & 零 & 個位(末位數) ElseIf 位數(8) = "0" And 位數(9) <> "0" And 位數(10) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(9)) & 百 & 個位(位數(10)) & 拾 ElseIf 位數(8) = "0" And 位數(9) <> "0" And 位數(10) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(9)) & 百 & 個位(位數(10)) & 拾 & 個位(末位數) ElseIf 位數(8) <> "0" And 位數(9) = "0" And 位數(10) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(8)) & 仟 ElseIf 位數(8) <> "0" And 位數(9) = "0" And 位數(10) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(8)) & 仟 & 零 & 個位(末位數) ElseIf 位數(8) <> "0" And 位數(9) = "0" And 位數(10) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(8)) & 仟 & 零 & 個位(位數(10)) & 拾 ElseIf 位數(8) <> "0" And 位數(9) = "0" And 位數(10) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(8)) & 仟 & 零 & 個位(位數(10)) & 拾 & 個位(末位數) ElseIf 位數(8) <> "0" And 位數(9) <> "0" And 位數(10) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(8)) & 仟 & 個位(位數(9)) & 百 ElseIf 位數(8) <> "0" And 位數(9) <> "0" And 位數(10) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(8)) & 仟 & 個位(位數(9)) & 百 & 零 & 個位(末位數) ElseIf 位數(8) <> "0" And 位數(9) <> "0" And 位數(10) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(8)) & 仟 & 個位(位數(9)) & 百 & 個位(位數(10)) & 拾 ElseIf 位數(8) <> "0" And 位數(9) <> "0" And 位數(10) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(8)) & 仟 & 個位(位數(9)) & 百 & 個位(位數(10)) & 拾 & 個位(末位數) End If ElseIf 數長 = 12 Then : 答案 = 個位(位數(1)) & 仟 If 位數(2) = "0" And 位數(3) = "0" And 位數(4) = "0" Then : 答案 &= 億 ElseIf 位數(2) = "0" And 位數(3) = "0" And 位數(4) <> "0" Then : 答案 &= 零 & 個位(位數(4)) & 億 ElseIf 位數(2) = "0" And 位數(3) <> "0" And 位數(4) <> "0" Then : 答案 &= 零 & 個位(位數(3)) & 拾 & 個位(位數(4)) & 億 ElseIf 位數(2) = "0" And 位數(3) <> "0" And 位數(4) = "0" Then : 答案 &= 零 & 個位(位數(3)) & 拾 & 億 ElseIf 位數(2) <> "0" And 位數(3) = "0" And 位數(4) = "0" Then : 答案 &= 個位(位數(2)) & 百 & 億 ElseIf 位數(2) <> "0" And 位數(3) = "0" And 位數(4) <> "0" Then : 答案 &= 個位(位數(2)) & 百 & 零 & 個位(位數(4)) & 億 ElseIf 位數(2) <> "0" And 位數(3) <> "0" And 位數(4) = "0" Then : 答案 &= 個位(位數(2)) & 百 & 個位(位數(3)) & 拾 & 億 ElseIf 位數(2) <> "0" And 位數(4) <> "0" And 位數(4) <> "0" Then : 答案 &= 個位(位數(2)) & 百 & 個位(位數(3)) & 拾 & 個位(位數(4)) & 億 End If If 位數(5) = "0" And 位數(6) = "0" And 位數(7) = "0" And 位數(8) = "0" Then ElseIf 位數(5) = "0" And 位數(6) = "0" And 位數(7) = "0" And 位數(8) <> "0" Then : 答案 &= 零 & 個位(位數(8)) & 萬 ElseIf 位數(5) = "0" And 位數(6) = "0" And 位數(7) <> "0" And 位數(8) = "0" Then : 答案 &= 零 & 個位(位數(7)) & 拾 & 萬 ElseIf 位數(5) = "0" And 位數(6) = "0" And 位數(7) <> "0" And 位數(8) <> "0" Then : 答案 &= 零 & 個位(位數(7)) & 拾 & 個位(位數(8)) & 萬 ElseIf 位數(5) = "0" And 位數(6) <> "0" And 位數(7) = "0" And 位數(8) = "0" Then : 答案 &= 零 & 個位(位數(6)) & 百 & 萬 ElseIf 位數(5) = "0" And 位數(6) <> "0" And 位數(7) = "0" And 位數(8) <> "0" Then : 答案 &= 零 & 個位(位數(6)) & 百 & 零 & 個位(位數(8)) & 萬 ElseIf 位數(5) = "0" And 位數(6) <> "0" And 位數(7) <> "0" And 位數(8) = "0" Then : 答案 &= 零 & 個位(位數(6)) & 百 & 個位(位數(7)) & 拾 & 萬 ElseIf 位數(5) = "0" And 位數(6) <> "0" And 位數(7) <> "0" And 位數(8) <> "0" Then : 答案 &= 零 & 個位(位數(6)) & 百 & 個位(位數(7)) & 拾 & 個位(位數(8)) & 萬 ElseIf 位數(5) <> "0" And 位數(6) = "0" And 位數(7) = "0" And 位數(8) = "0" Then : 答案 &= 個位(位數(5)) & 仟 & 萬 ElseIf 位數(5) <> "0" And 位數(6) = "0" And 位數(7) = "0" And 位數(8) <> "0" Then : 答案 &= 個位(位數(5)) & 仟 & 零 & 個位(位數(8)) & 萬 ElseIf 位數(5) <> "0" And 位數(6) = "0" And 位數(7) <> "0" And 位數(8) = "0" Then : 答案 &= 個位(位數(5)) & 仟 & 零 & 個位(位數(7)) & 拾 & 萬 ElseIf 位數(5) <> "0" And 位數(6) = "0" And 位數(7) <> "0" And 位數(8) <> "0" Then : 答案 &= 個位(位數(5)) & 仟 & 零 & 個位(位數(7)) & 拾 & 個位(位數(8)) & 萬 ElseIf 位數(5) <> "0" And 位數(6) <> "0" And 位數(7) = "0" And 位數(8) = "0" Then : 答案 &= 個位(位數(5)) & 仟 & 個位(位數(6)) & 百 & 萬 ElseIf 位數(5) <> "0" And 位數(6) <> "0" And 位數(7) = "0" And 位數(8) <> "0" Then : 答案 &= 個位(位數(5)) & 仟 & 個位(位數(6)) & 百 & 零 & 個位(位數(8)) & 萬 ElseIf 位數(5) <> "0" And 位數(6) <> "0" And 位數(7) <> "0" And 位數(8) = "0" Then : 答案 &= 個位(位數(5)) & 仟 & 個位(位數(6)) & 百 & 個位(位數(7)) & 拾 & 萬 ElseIf 位數(5) <> "0" And 位數(6) <> "0" And 位數(7) <> "0" And 位數(8) <> "0" Then : 答案 &= 個位(位數(5)) & 仟 & 個位(位數(6)) & 百 & 個位(位數(7)) & 拾 & 個位(位數(8)) & 萬 End If If 位數(9) = "0" And 位數(10) = "0" And 位數(11) = "0" And 末位數 = "0" Then ElseIf 位數(9) = "0" And 位數(10) = "0" And 位數(11) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(末位數) ElseIf 位數(9) = "0" And 位數(10) = "0" And 位數(11) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(11)) & 拾 ElseIf 位數(9) = "0" And 位數(10) = "0" And 位數(11) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(11)) & 拾 & 個位(末位數) ElseIf 位數(9) = "0" And 位數(10) <> "0" And 位數(11) = "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(10)) & 百 ElseIf 位數(9) = "0" And 位數(10) <> "0" And 位數(11) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(10)) & 百 & 零 & 個位(末位數) ElseIf 位數(9) = "0" And 位數(10) <> "0" And 位數(11) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(10)) & 百 & 個位(位數(11)) & 拾 ElseIf 位數(9) = "0" And 位數(10) <> "0" And 位數(11) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(10)) & 百 & 個位(位數(11)) & 拾 & 個位(末位數) ElseIf 位數(9) <> "0" And 位數(10) = "0" And 位數(11) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(9)) & 仟 ElseIf 位數(9) <> "0" And 位數(10) = "0" And 位數(11) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(9)) & 仟 & 零 & 個位(末位數) ElseIf 位數(9) <> "0" And 位數(10) = "0" And 位數(11) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(9)) & 仟 & 零 & 個位(位數(11)) & 拾 ElseIf 位數(9) <> "0" And 位數(10) = "0" And 位數(11) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(9)) & 仟 & 零 & 個位(位數(11)) & 拾 & 個位(末位數) ElseIf 位數(9) <> "0" And 位數(10) <> "0" And 位數(11) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(9)) & 仟 & 個位(位數(10)) & 百 ElseIf 位數(9) <> "0" And 位數(10) <> "0" And 位數(11) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(9)) & 仟 & 個位(位數(10)) & 百 & 零 & 個位(末位數) ElseIf 位數(9) <> "0" And 位數(10) <> "0" And 位數(11) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(9)) & 仟 & 個位(位數(10)) & 百 & 個位(位數(11)) & 拾 ElseIf 位數(9) <> "0" And 位數(10) <> "0" And 位數(11) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(9)) & 仟 & 個位(位數(10)) & 百 & 個位(位數(11)) & 拾 & 個位(末位數) End If ElseIf 數長 = 13 Then : 答案 = 個位(位數(1)) & 兆 : 答案 &= 個位(位數(2)) & 仟 If 位數(3) = "0" And 位數(4) = "0" And 位數(5) = "0" Then : 答案 &= 億 ElseIf 位數(3) = "0" And 位數(4) = "0" And 位數(5) <> "0" Then : 答案 &= 零 & 個位(位數(5)) & 億 ElseIf 位數(3) = "0" And 位數(4) <> "0" And 位數(5) <> "0" Then : 答案 &= 零 & 個位(位數(4)) & 拾 & 個位(位數(5)) & 億 ElseIf 位數(3) = "0" And 位數(4) <> "0" And 位數(5) = "0" Then : 答案 &= 零 & 個位(位數(4)) & 拾 & 億 ElseIf 位數(3) <> "0" And 位數(4) = "0" And 位數(5) = "0" Then : 答案 &= 個位(位數(3)) & 百 & 億 ElseIf 位數(3) <> "0" And 位數(4) = "0" And 位數(5) <> "0" Then : 答案 &= 個位(位數(3)) & 百 & 零 & 個位(位數(5)) & 億 ElseIf 位數(3) <> "0" And 位數(4) <> "0" And 位數(5) = "0" Then : 答案 &= 個位(位數(3)) & 百 & 個位(位數(4)) & 拾 & 億 ElseIf 位數(3) <> "0" And 位數(5) <> "0" And 位數(5) <> "0" Then : 答案 &= 個位(位數(3)) & 百 & 個位(位數(4)) & 拾 & 個位(位數(5)) & 億 End If If 位數(6) = "0" And 位數(7) = "0" And 位數(8) = "0" And 位數(9) = "0" Then ElseIf 位數(6) = "0" And 位數(7) = "0" And 位數(8) = "0" And 位數(9) <> "0" Then : 答案 &= 零 & 個位(位數(9)) & 萬 ElseIf 位數(6) = "0" And 位數(7) = "0" And 位數(8) <> "0" And 位數(9) = "0" Then : 答案 &= 零 & 個位(位數(8)) & 拾 & 萬 ElseIf 位數(6) = "0" And 位數(7) = "0" And 位數(8) <> "0" And 位數(9) <> "0" Then : 答案 &= 零 & 個位(位數(8)) & 拾 & 個位(位數(9)) & 萬 ElseIf 位數(6) = "0" And 位數(7) <> "0" And 位數(8) = "0" And 位數(9) = "0" Then : 答案 &= 零 & 個位(位數(7)) & 百 & 萬 ElseIf 位數(6) = "0" And 位數(7) <> "0" And 位數(8) = "0" And 位數(9) <> "0" Then : 答案 &= 零 & 個位(位數(7)) & 百 & 零 & 個位(位數(9)) & 萬 ElseIf 位數(6) = "0" And 位數(7) <> "0" And 位數(8) <> "0" And 位數(9) = "0" Then : 答案 &= 零 & 個位(位數(7)) & 百 & 個位(位數(8)) & 拾 & 萬 ElseIf 位數(6) = "0" And 位數(7) <> "0" And 位數(8) <> "0" And 位數(9) <> "0" Then : 答案 &= 零 & 個位(位數(7)) & 百 & 個位(位數(8)) & 拾 & 個位(位數(9)) & 萬 ElseIf 位數(6) <> "0" And 位數(7) = "0" And 位數(8) = "0" And 位數(9) = "0" Then : 答案 &= 個位(位數(6)) & 仟 & 萬 ElseIf 位數(6) <> "0" And 位數(7) = "0" And 位數(8) = "0" And 位數(9) <> "0" Then : 答案 &= 個位(位數(6)) & 仟 & 零 & 個位(位數(9)) & 萬 ElseIf 位數(6) <> "0" And 位數(7) = "0" And 位數(8) <> "0" And 位數(9) = "0" Then : 答案 &= 個位(位數(6)) & 仟 & 零 & 個位(位數(8)) & 拾 & 萬 ElseIf 位數(6) <> "0" And 位數(7) = "0" And 位數(8) <> "0" And 位數(9) <> "0" Then : 答案 &= 個位(位數(6)) & 仟 & 零 & 個位(位數(8)) & 拾 & 個位(位數(9)) & 萬 ElseIf 位數(6) <> "0" And 位數(7) <> "0" And 位數(8) = "0" And 位數(9) = "0" Then : 答案 &= 個位(位數(6)) & 仟 & 個位(位數(7)) & 百 & 萬 ElseIf 位數(6) <> "0" And 位數(7) <> "0" And 位數(8) = "0" And 位數(9) <> "0" Then : 答案 &= 個位(位數(6)) & 仟 & 個位(位數(7)) & 百 & 零 & 個位(位數(9)) & 萬 ElseIf 位數(6) <> "0" And 位數(7) <> "0" And 位數(8) <> "0" And 位數(9) = "0" Then : 答案 &= 個位(位數(6)) & 仟 & 個位(位數(7)) & 百 & 個位(位數(8)) & 拾 & 萬 ElseIf 位數(6) <> "0" And 位數(7) <> "0" And 位數(8) <> "0" And 位數(9) <> "0" Then : 答案 &= 個位(位數(6)) & 仟 & 個位(位數(7)) & 百 & 個位(位數(8)) & 拾 & 個位(位數(9)) & 萬 End If If 位數(10) = "0" And 位數(11) = "0" And 位數(12) = "0" And 末位數 = "0" Then ElseIf 位數(10) = "0" And 位數(11) = "0" And 位數(12) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(末位數) ElseIf 位數(10) = "0" And 位數(11) = "0" And 位數(12) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(12)) & 拾 ElseIf 位數(10) = "0" And 位數(11) = "0" And 位數(12) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(12)) & 拾 & 個位(末位數) ElseIf 位數(10) = "0" And 位數(11) <> "0" And 位數(12) = "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(11)) & 百 ElseIf 位數(10) = "0" And 位數(11) <> "0" And 位數(12) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(11)) & 百 & 零 & 個位(末位數) ElseIf 位數(10) = "0" And 位數(11) <> "0" And 位數(12) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(11)) & 百 & 個位(位數(12)) & 拾 ElseIf 位數(10) = "0" And 位數(11) <> "0" And 位數(12) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(11)) & 百 & 個位(位數(12)) & 拾 & 個位(末位數) ElseIf 位數(10) <> "0" And 位數(11) = "0" And 位數(12) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(10)) & 仟 ElseIf 位數(10) <> "0" And 位數(11) = "0" And 位數(12) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(10)) & 仟 & 零 & 個位(末位數) ElseIf 位數(10) <> "0" And 位數(11) = "0" And 位數(12) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(10)) & 仟 & 零 & 個位(位數(12)) & 拾 ElseIf 位數(10) <> "0" And 位數(11) = "0" And 位數(12) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(10)) & 仟 & 零 & 個位(位數(12)) & 拾 & 個位(末位數) ElseIf 位數(10) <> "0" And 位數(11) <> "0" And 位數(12) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(10)) & 仟 & 個位(位數(11)) & 百 ElseIf 位數(10) <> "0" And 位數(11) <> "0" And 位數(12) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(10)) & 仟 & 個位(位數(11)) & 百 & 零 & 個位(末位數) ElseIf 位數(10) <> "0" And 位數(11) <> "0" And 位數(12) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(10)) & 仟 & 個位(位數(11)) & 百 & 個位(位數(12)) & 拾 ElseIf 位數(10) <> "0" And 位數(11) <> "0" And 位數(12) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(10)) & 仟 & 個位(位數(11)) & 百 & 個位(位數(12)) & 拾 & 個位(末位數) End If ElseIf 數長 = 14 Then If 位數(2) = "0" Then : 答案 = 個位(位數(1)) & 拾 & 兆 : Else : 答案 = 個位(位數(1)) & 拾 & 個位(位數(2)) & 兆 : End If : 答案 &= 個位(位數(3)) & 仟 If 位數(4) = "0" And 位數(5) = "0" And 位數(6) = "0" Then : 答案 &= 億 ElseIf 位數(4) = "0" And 位數(5) = "0" And 位數(6) <> "0" Then : 答案 &= 零 & 個位(位數(6)) & 億 ElseIf 位數(4) = "0" And 位數(5) <> "0" And 位數(6) <> "0" Then : 答案 &= 零 & 個位(位數(5)) & 拾 & 個位(位數(6)) & 億 ElseIf 位數(4) = "0" And 位數(5) <> "0" And 位數(6) = "0" Then : 答案 &= 零 & 個位(位數(5)) & 拾 & 億 ElseIf 位數(4) <> "0" And 位數(5) = "0" And 位數(6) = "0" Then : 答案 &= 個位(位數(4)) & 百 & 億 ElseIf 位數(4) <> "0" And 位數(5) = "0" And 位數(6) <> "0" Then : 答案 &= 個位(位數(4)) & 百 & 零 & 個位(位數(6)) & 億 ElseIf 位數(4) <> "0" And 位數(5) <> "0" And 位數(6) = "0" Then : 答案 &= 個位(位數(4)) & 百 & 個位(位數(5)) & 拾 & 億 ElseIf 位數(4) <> "0" And 位數(6) <> "0" And 位數(6) <> "0" Then : 答案 &= 個位(位數(4)) & 百 & 個位(位數(5)) & 拾 & 個位(位數(6)) & 億 End If If 位數(7) = "0" And 位數(8) = "0" And 位數(9) = "0" And 位數(10) = "0" Then ElseIf 位數(7) = "0" And 位數(8) = "0" And 位數(9) = "0" And 位數(10) <> "0" Then : 答案 &= 零 & 個位(位數(10)) & 萬 ElseIf 位數(7) = "0" And 位數(8) = "0" And 位數(9) <> "0" And 位數(10) = "0" Then : 答案 &= 零 & 個位(位數(9)) & 拾 & 萬 ElseIf 位數(7) = "0" And 位數(8) = "0" And 位數(9) <> "0" And 位數(10) <> "0" Then : 答案 &= 零 & 個位(位數(9)) & 拾 & 個位(位數(10)) & 萬 ElseIf 位數(7) = "0" And 位數(8) <> "0" And 位數(9) = "0" And 位數(10) = "0" Then : 答案 &= 零 & 個位(位數(8)) & 百 & 萬 ElseIf 位數(7) = "0" And 位數(8) <> "0" And 位數(9) = "0" And 位數(10) <> "0" Then : 答案 &= 零 & 個位(位數(8)) & 百 & 零 & 個位(位數(10)) & 萬 ElseIf 位數(7) = "0" And 位數(8) <> "0" And 位數(9) <> "0" And 位數(10) = "0" Then : 答案 &= 零 & 個位(位數(8)) & 百 & 個位(位數(9)) & 拾 & 萬 ElseIf 位數(7) = "0" And 位數(8) <> "0" And 位數(9) <> "0" And 位數(10) <> "0" Then : 答案 &= 零 & 個位(位數(8)) & 百 & 個位(位數(9)) & 拾 & 個位(位數(10)) & 萬 ElseIf 位數(7) <> "0" And 位數(8) = "0" And 位數(9) = "0" And 位數(10) = "0" Then : 答案 &= 個位(位數(7)) & 仟 & 萬 ElseIf 位數(7) <> "0" And 位數(8) = "0" And 位數(9) = "0" And 位數(10) <> "0" Then : 答案 &= 個位(位數(7)) & 仟 & 零 & 個位(位數(10)) & 萬 ElseIf 位數(7) <> "0" And 位數(8) = "0" And 位數(9) <> "0" And 位數(10) = "0" Then : 答案 &= 個位(位數(7)) & 仟 & 零 & 個位(位數(9)) & 拾 & 萬 ElseIf 位數(7) <> "0" And 位數(8) = "0" And 位數(9) <> "0" And 位數(10) <> "0" Then : 答案 &= 個位(位數(7)) & 仟 & 零 & 個位(位數(9)) & 拾 & 個位(位數(10)) & 萬 ElseIf 位數(7) <> "0" And 位數(8) <> "0" And 位數(9) = "0" And 位數(10) = "0" Then : 答案 &= 個位(位數(7)) & 仟 & 個位(位數(8)) & 百 & 萬 ElseIf 位數(7) <> "0" And 位數(8) <> "0" And 位數(9) = "0" And 位數(10) <> "0" Then : 答案 &= 個位(位數(7)) & 仟 & 個位(位數(8)) & 百 & 零 & 個位(位數(10)) & 萬 ElseIf 位數(7) <> "0" And 位數(8) <> "0" And 位數(9) <> "0" And 位數(10) = "0" Then : 答案 &= 個位(位數(7)) & 仟 & 個位(位數(8)) & 百 & 個位(位數(9)) & 拾 & 萬 ElseIf 位數(7) <> "0" And 位數(8) <> "0" And 位數(9) <> "0" And 位數(10) <> "0" Then : 答案 &= 個位(位數(7)) & 仟 & 個位(位數(8)) & 百 & 個位(位數(9)) & 拾 & 個位(位數(10)) & 萬 End If If 位數(11) = "0" And 位數(12) = "0" And 位數(13) = "0" And 末位數 = "0" Then ElseIf 位數(11) = "0" And 位數(12) = "0" And 位數(13) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(末位數) ElseIf 位數(11) = "0" And 位數(12) = "0" And 位數(13) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(13)) & 拾 ElseIf 位數(11) = "0" And 位數(12) = "0" And 位數(13) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(13)) & 拾 & 個位(末位數) ElseIf 位數(11) = "0" And 位數(12) <> "0" And 位數(13) = "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(12)) & 百 ElseIf 位數(11) = "0" And 位數(12) <> "0" And 位數(13) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(12)) & 百 & 零 & 個位(末位數) ElseIf 位數(11) = "0" And 位數(12) <> "0" And 位數(13) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(12)) & 百 & 個位(位數(13)) & 拾 ElseIf 位數(11) = "0" And 位數(12) <> "0" And 位數(13) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(12)) & 百 & 個位(位數(13)) & 拾 & 個位(末位數) ElseIf 位數(11) <> "0" And 位數(12) = "0" And 位數(13) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(11)) & 仟 ElseIf 位數(11) <> "0" And 位數(12) = "0" And 位數(13) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(11)) & 仟 & 零 & 個位(末位數) ElseIf 位數(11) <> "0" And 位數(12) = "0" And 位數(13) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(11)) & 仟 & 零 & 個位(位數(13)) & 拾 ElseIf 位數(11) <> "0" And 位數(12) = "0" And 位數(13) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(11)) & 仟 & 零 & 個位(位數(13)) & 拾 & 個位(末位數) ElseIf 位數(11) <> "0" And 位數(12) <> "0" And 位數(13) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(11)) & 仟 & 個位(位數(12)) & 百 ElseIf 位數(11) <> "0" And 位數(12) <> "0" And 位數(13) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(11)) & 仟 & 個位(位數(12)) & 百 & 零 & 個位(末位數) ElseIf 位數(11) <> "0" And 位數(12) <> "0" And 位數(13) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(11)) & 仟 & 個位(位數(12)) & 百 & 個位(位數(13)) & 拾 ElseIf 位數(11) <> "0" And 位數(12) <> "0" And 位數(13) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(11)) & 仟 & 個位(位數(12)) & 百 & 個位(位數(13)) & 拾 & 個位(末位數) End If End If End If If 系統語言 = "繁體中文" Then : 金額大寫_tb.Text = 答案 & " 元整" ElseIf 系統語言 = "Indonesian" Then : 金額大寫_tb.Text = 答案 & " Rupiah" ElseIf 系統語言 = "English" Then : 金額大寫_tb.Text = 答案 & " Rupee" : End If End Sub Private Sub 列印成EXCEL_bt_Click(sender As Object, e As EventArgs) Handles 列印成EXCEL_bt.Click If 主管_tb.Text = "" Then : MGB(對話框(9), 1) : Else If 系統單號_bt.Text = "" Then : MGB(對話框(3), 1) : 首次開啟 = False : Else xlApp = CType(CreateObject("Excel.Application"), Application) xlBook = xlApp.Workbooks.Add xlApp.DisplayAlerts = True xlApp.Visible = True xlApp.Application.WindowState = xlMaximized xlSheet = NewMethod(xlBook) : xlApp.Sheets(1).Select xlApp.Sheets(1).Name = 單號_tb.Text.Replace("/", "_") : xlBook.Activate() : xlSheet.Activate() xlSheet.Cells(2, 1) = Label7.Text xlSheet.Cells(3, 1) = 單號_tb.Text xlSheet.Cells(5, 2) = Label2.Text : xlSheet.Cells(5, 3) = "' : " : xlSheet.Cells(5, 4) = "'" & Strings.Format(申請日期_dtp.Value, "yyyy/MM/dd") xlSheet.Cells(6, 2) = Label1.Text : xlSheet.Cells(6, 3) = "' : " : xlSheet.Cells(6, 4) = 部門選單_cb.Text xlSheet.Cells(7, 2) = Label3.Text : xlSheet.Cells(7, 3) = "' : " : xlSheet.Cells(7, 4) = Strings.Format(申請金額_nud.Value, "#,##0") xlSheet.Cells(8, 2) = Label4.Text : xlSheet.Cells(8, 3) = "' : " : xlSheet.Cells(8, 4) = 金額大寫_tb.Text xlSheet.Cells(9, 2) = Label5.Text : xlSheet.Cells(9, 3) = "' : " : xlSheet.Cells(9, 4) = 內容_tb.Text xlSheet.Cells(10, 2) = Label6.Text : xlSheet.Cells(10, 3) = "' : " xlSheet.Cells(10, 4) = Label18.Text & " / " & 支付對象_tb.Text & vbLf & Label15.Text & " / " & 營行帳號_tb.Text & vbLf & Label17.Text & " / " & 支付銀行_tb.Text & vbLf & Label16.Text & " / " & 銀行支行_tb.Text xlSheet.Cells(12, 2) = Label8.Text : xlSheet.Cells(13, 2) = 申請人_tb.Text xlSheet.Cells(12, 4) = Label19.Text : xlSheet.Cells(13, 4) = 檢查人_tb.Text xlSheet.Cells(12, 6) = Label9.Text : xlSheet.Cells(13, 6) = 主管_tb.Text : xlSheet.Cells(14, 6) = Label11.Text xlSheet.Cells(12, 8) = Label10.Text : xlSheet.Cells(13, 8) = 審核人_tb.Text : xlSheet.Cells(14, 8) = Label12.Text AA(xlApp, xlSheet) If 單號_tb.Text.Contains("HXI") Then : CC(xlApp, xlSheet) : Else : DD(xlApp, xlSheet) : End If xlApp.Sheets(2).Delete : xlSheet.PageSetup.PrintArea = "" '-------------轉換成PDF--------------------------------------------------------------------- Dim SERT As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) xlBook.Sheets(1).ExportAsFixedFormat(XlFixedFormatType.xlTypePDF, SERT & "\" & 單號_tb.Text.Replace("/", "_") & ".pdf", XlFixedFormatQuality.xlQualityStandard, True) '-------------關閉EXCEL--------------------------------------------------------------------- xlApp.Cells.Select() : xlApp.Application.WindowState = xlMinimized xlBook.Close(False) Runtime.InteropServices.Marshal.ReleaseComObject(xlSheet) Runtime.InteropServices.Marshal.ReleaseComObject(xlBook) Runtime.InteropServices.Marshal.ReleaseComObject(xlApp) xlApp.Quit() : xlSheet = Nothing : xlBook = Nothing : xlApp = Nothing : GC.Collect() '-------------開啟PDF--------------------------------------------------------------------- Dim pdfFilePath As String = SERT & "\" & 單號_tb.Text.Replace("/", "_") & ".pdf" If IsChromeInstalled() Then Try Dim chromeProcess As New Process() chromeProcess.StartInfo.FileName = "chrome" chromeProcess.StartInfo.Arguments = """" & pdfFilePath & """" chromeProcess.Start() Catch ex As Exception End Try Else Try System.Diagnostics.Process.Start("""" & pdfFilePath & """") Catch ex As Exception End Try End If MGB(系統語言字典("H508-121-" & 語言), 1) : 首次開啟 = False End If End If End Sub ' 檢查系統是否已安裝 Google Chrome Private Function IsChromeInstalled() As Boolean Dim key As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall") If key IsNot Nothing Then For Each subkeyName As String In key.GetSubKeyNames() Dim subkey As Microsoft.Win32.RegistryKey = key.OpenSubKey(subkeyName) Dim displayName As Object = subkey.GetValue("DisplayName") If displayName IsNot Nothing AndAlso displayName.ToString().Contains("Google Chrome") Then Return True End If Next End If Return False End Function Private Shared Function NewMethod(xlBook As Workbook) As Worksheet Return CType(xlBook.Worksheets.Add, Worksheet) End Function Private Sub AA(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Worksheet) xlSheet.Cells.Select() With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 12 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 90 : xlSheet.Rows("2:2").Select : myExcel.Selection.RowHeight = 25 xlSheet.Rows("3:3").Select : myExcel.Selection.RowHeight = 19 : xlSheet.Rows("5:7").Select : myExcel.Selection.RowHeight = 25 xlSheet.Rows("8:8").Select : myExcel.Selection.RowHeight = 50 : xlSheet.Rows("9:9").Select : myExcel.Selection.RowHeight = 100 xlSheet.Rows("10:10").Select : myExcel.Selection.RowHeight = 80 : xlSheet.Rows("13:13").Select : myExcel.Selection.RowHeight = 50 xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 4 : xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 20 xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 1.7 : xlSheet.Columns("D:D").Select : myExcel.Selection.ColumnWidth = 30 xlSheet.Columns("E:E").Select : myExcel.Selection.ColumnWidth = 10 : xlSheet.Columns("F:F").Select : myExcel.Selection.ColumnWidth = 30 xlSheet.Columns("G:G").Select : myExcel.Selection.ColumnWidth = 10 : xlSheet.Columns("H:H").Select : myExcel.Selection.ColumnWidth = 30 xlSheet.Columns("I:I").Select : myExcel.Selection.ColumnWidth = 4 xlSheet.Range("A2:I2").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 22 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With xlSheet.Range("A3:I3").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 14 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With xlSheet.Range("B5:C10").Select() With myExcel.Selection : .HorizontalAlignment = xlGeneral : .VerticalAlignment = xlTop : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With xlSheet.Range("D5:H5").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("D6:H6").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("D7:H7").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("D8:H8").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("D9:H9").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("D10:H10").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With xlSheet.Range("D12:H14").Select() With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With xlSheet.Range("A1:I2").Select() myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Range("A3:I3").Select() myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Range("A4:I14").Select() myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Range("D5:H5").Select() myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Range("D6:H6").Select() myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Range("D7:H7").Select() myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Range("D8:H8").Select() myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Range("D9:H9").Select() myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Range("D10:H10").Select() myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Range("F13").Select() myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone xlSheet.Range("H13").Select() myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone myExcel.ActiveWindow.DisplayGridlines = False xlSheet.Range("B5:B10").Select() : myExcel.Selection.Font.Bold = True : xlSheet.Range("D12:H12").Select() : myExcel.Selection.Font.Bold = True xlSheet.Range("F14:H14").Select() : myExcel.Selection.Font.Bold = True xlSheet.Range("D8:H10").Select() With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = True : .Orientation = 0 : .AddIndent = False .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : End With xlSheet.Range("B13").Select() myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone With myExcel.Selection : .HorizontalAlignment = xlGeneral : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With xlSheet.Range("D13").Select() myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone With myExcel.Selection : .HorizontalAlignment = xlGeneral : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With myExcel.ActiveSheet.PageSetup.CenterHeaderPicture.Filename = Str01 & "\HXBWLOG.png" myExcel.Application.PrintCommunication = False : With myExcel.ActiveSheet.PageSetup : .PrintTitleRows = "" : .PrintTitleColumns = "" : End With myExcel.Application.PrintCommunication = True : myExcel.ActiveSheet.PageSetup.PrintArea = "" : myExcel.Application.PrintCommunication = False With myExcel.ActiveSheet.PageSetup : .LeftHeader = "" .CenterHeader = "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "&G" .RightHeader = "" : .LeftFooter = "" : .CenterFooter = "" : .RightFooter = "" .LeftMargin = myExcel.Application.InchesToPoints(0.236220472440945) : .RightMargin = myExcel.Application.InchesToPoints(0.236220472440945) .TopMargin = myExcel.Application.InchesToPoints(0.748031496062992) : .BottomMargin = myExcel.Application.InchesToPoints(0.748031496062992) .HeaderMargin = myExcel.Application.InchesToPoints(0.31496062992126) : .FooterMargin = myExcel.Application.InchesToPoints(0.31496062992126) .PrintHeadings = False : .PrintGridlines = False : .CenterHorizontally = True : .CenterVertically = False .Draft = False : .FirstPageNumber = xlAutomatic : .BlackAndWhite = False : .Zoom = False : .FitToPagesWide = 1 : .FitToPagesTall = False .OddAndEvenPagesHeaderFooter = False : .DifferentFirstPageHeaderFooter = False : .ScaleWithDocHeaderFooter = True : .AlignMarginsHeaderFooter = True .EvenPage.LeftHeader.Text = "" : .EvenPage.CenterHeader.Text = "" : .EvenPage.RightHeader.Text = "" : .EvenPage.LeftFooter.Text = "" .EvenPage.CenterFooter.Text = "" : .EvenPage.RightFooter.Text = "" : .FirstPage.LeftHeader.Text = "" : .FirstPage.CenterHeader.Text = "" .FirstPage.RightHeader.Text = "" : .FirstPage.LeftFooter.Text = "" : .FirstPage.CenterFooter.Text = "" : .FirstPage.RightFooter.Text = "" End With myExcel.Application.PrintCommunication = True End Sub Private Sub CC(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Worksheet) Clipboard.SetDataObject(PictureBox1.Image) xlSheet.Range("A1").Select() myExcel.ActiveSheet.Pictures.Paste.Select myExcel.Selection.ShapeRange.Height = 88 myExcel.Selection.ShapeRange.IncrementLeft(50) myExcel.Selection.ShapeRange.IncrementTop(2) End Sub Private Sub DD(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Worksheet) Clipboard.SetDataObject(PictureBox2.Image) xlSheet.Range("A1").Select() myExcel.ActiveSheet.Pictures.Paste.Select myExcel.Selection.ShapeRange.Height = 88 myExcel.Selection.ShapeRange.IncrementLeft(50) myExcel.Selection.ShapeRange.IncrementTop(2) End Sub Private Sub HX_ch_CheckedChanged(sender As Object, e As EventArgs) Handles HX_ch.Click HX_ch.Checked = True : PGS_ch.Checked = False : ALL_ch.Checked = False : Set_清單1() End Sub Private Sub PGS_ch_CheckedChanged(sender As Object, e As EventArgs) Handles PGS_ch.Click HX_ch.Checked = False : PGS_ch.Checked = True : ALL_ch.Checked = False : Set_清單1() End Sub Private Sub ALL_ch_CheckedChanged(sender As Object, e As EventArgs) Handles ALL_ch.Click HX_ch.Checked = False : PGS_ch.Checked = False : ALL_ch.Checked = True : Set_清單1() End Sub Private Sub 月_ch_Click(sender As Object, e As EventArgs) Handles 月_ch.Click 月_ch.Checked = True : 週_ch.Checked = False : 日_ch.Checked = False : 修改BT() : 當月_bt.PerformClick() End Sub Private Sub 週_ch_Click(sender As Object, e As EventArgs) Handles 週_ch.Click 月_ch.Checked = False : 週_ch.Checked = True : 日_ch.Checked = False : 修改BT() : 當月_bt.PerformClick() End Sub Private Sub 日_ch_Click(sender As Object, e As EventArgs) Handles 日_ch.Click 月_ch.Checked = False : 週_ch.Checked = False : 日_ch.Checked = True : 修改BT() : 當月_bt.PerformClick() End Sub Private Sub 當月_bt_Click(sender As Object, e As EventArgs) Handles 當月_bt.Click If 月_ch.Checked Then 開始日期_dtp.Value = New Date(Today.Year, Today.Month, 1) 結束日期_dtp.Value = 開始日期_dtp.Value.AddMonths(1).AddDays(-1) ElseIf 週_ch.Checked Then 開始日期_dtp.Value = Today.AddDays(-Today.DayOfWeek) 結束日期_dtp.Value = Today.AddDays(6 - Today.DayOfWeek) ElseIf 日_ch.Checked Then 開始日期_dtp.Value = Today 結束日期_dtp.Value = Today End If End Sub Private Sub 上個月_bt_Click(sender As Object, e As EventArgs) Handles 上個月_bt.Click If 月_ch.Checked Then Dim today As Date = 開始日期_dtp.Value Dim 前一個月第一天 As Date = today.AddMonths(-1).AddDays(1 - today.Day) Dim 前一個月最後一天 As Date = 前一個月第一天.AddMonths(1).AddDays(-1) 開始日期_dtp.Value = 前一個月第一天 結束日期_dtp.Value = 前一個月最後一天 ElseIf 週_ch.Checked Then Dim today As Date = 開始日期_dtp.Value Dim 前一週第一天 As Date = today.AddDays(-7) Dim 前一週最後一天 As Date = today.AddDays(-1) 開始日期_dtp.Value = 前一週第一天 結束日期_dtp.Value = 前一週最後一天 ElseIf 日_ch.Checked Then Dim today As Date = 開始日期_dtp.Value 開始日期_dtp.Value = today.AddDays(-1) 結束日期_dtp.Value = today.AddDays(-1) End If End Sub Private Sub 下個月_bt_Click(sender As Object, e As EventArgs) Handles 下個月_bt.Click If 月_ch.Checked Then Dim today As Date = 開始日期_dtp.Value Dim 下個月第一天 As Date = today.AddMonths(1).AddDays(-today.Day + 1) Dim 下個月最後一天 As Date = 下個月第一天.AddMonths(1).AddDays(-1) 開始日期_dtp.Value = 下個月第一天 結束日期_dtp.Value = 下個月最後一天 ElseIf 週_ch.Checked Then Dim today As Date = 開始日期_dtp.Value Dim 下一週第一天 As Date = today.AddDays(7) Dim 下一週最後一天 As Date = today.AddDays(13) 開始日期_dtp.Value = 下一週第一天 結束日期_dtp.Value = 下一週最後一天 ElseIf 日_ch.Checked Then Dim today As Date = 開始日期_dtp.Value 開始日期_dtp.Value = today.AddDays(1) 結束日期_dtp.Value = today.AddDays(1) End If End Sub Private Sub 支付對象_cb_Click(sender As Object, e As EventArgs) Handles 支付對象_cb.Click CB選擇清單(支付對象_cb, 支付對象_cb.Text) End Sub Private Sub 支付對象_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 支付對象_cb.SelectedIndexChanged If 支付對象_cb.Text.Substring(0, 1) = "A" Then For i As Integer = 0 To 支付對象1_dgv.Rows.Count - 1 Dim 要寫入的文字 As String = 支付對象_cb.Text.Substring(2) If 要寫入的文字 = 支付對象1_dgv.Rows(i).Cells(2).Value.ToString Then 支付對象_cb.Text = 支付對象1_dgv.Rows(i).Cells(2).Value.ToString : 支付對象_tb.Text = 支付對象1_dgv.Rows(i).Cells(2).Value.ToString 支付銀行_tb.Text = 支付對象1_dgv.Rows(i).Cells(3).Value.ToString : 營行帳號_tb.Text = 支付對象1_dgv.Rows(i).Cells(4).Value.ToString 銀行支行_tb.Text = 支付對象1_dgv.Rows(i).Cells(5).Value.ToString Exit For End If Next 支付銀行_tb.Enabled = False : 營行帳號_tb.Enabled = False : 銀行支行_tb.Enabled = False ElseIf 支付對象_cb.Text.Substring(0, 1) = "B" Then SQL_查詢支付對象資料(支付對象_cb.Text.Substring(2)) If dr.Read() Then 支付對象_cb.Text = dr(0).ToString : 支付對象_tb.Text = dr(0).ToString 支付銀行_tb.Text = dr(1).ToString : 營行帳號_tb.Text = dr(2).ToString 銀行支行_tb.Text = dr(3).ToString Else 支付對象_cb.Text = 支付對象_cb.Text.Substring(2) : 支付對象_tb.Text = 支付對象_cb.Text.Substring(2) 支付銀行_tb.Text = "" : 營行帳號_tb.Text = "" : 銀行支行_tb.Text = "" End If 支付銀行_tb.Enabled = True : 營行帳號_tb.Enabled = True : 銀行支行_tb.Enabled = True End If End Sub Private Sub 條件_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 條件_cb.SelectedIndexChanged If 已開啟 = True Then : Set_清單1() : End If End Sub Private Sub 解開星期五_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 解開星期五_ch.Click If 解開星期五_ch.Checked = True Then : 支付日期_dtp.Enabled = True : Else : 支付日期_dtp.Enabled = False : End If End Sub Private Sub 結束日期_dtp_ValueChanged(sender As Object, e As EventArgs) Handles 結束日期_dtp.ValueChanged If 已開啟 = True Then : Set_清單1() : End If End Sub Private Sub 風格() If 深色風格 = False Then Me.BackColor = SystemColors.Control 財務單號_lb.ForeColor = Color.Black : Label1.ForeColor = Color.Black : Label2.ForeColor = Color.Black : 補單_cb.ForeColor = Color.Black Label3.ForeColor = Color.Black : Label4.ForeColor = Color.Black : Label5.ForeColor = Color.Black : 會計科目_lb.ForeColor = Color.Black Label6.ForeColor = Color.Black : Label7.ForeColor = Color.Black : Label8.ForeColor = Color.Black : Label9.ForeColor = Color.Black Label10.ForeColor = Color.Black : Label11.ForeColor = Color.Black : Label12.ForeColor = Color.Black : Label13.ForeColor = Color.Black Label14.ForeColor = Color.Black : HX_ch.ForeColor = Color.Black : PGS_ch.ForeColor = Color.Black : ALL_ch.ForeColor = Color.Black Label18.ForeColor = Color.Black : Label17.ForeColor = Color.Black : Label15.ForeColor = Color.Black : Label16.ForeColor = Color.Black Label19.ForeColor = Color.Black 單號_tb.BackColor = Color.White : 單號_tb.ForeColor = Color.Black : 部門選單_cb.BackColor = Color.White : 部門選單_cb.ForeColor = Color.Black 申請金額_nud.BackColor = Color.White : 申請金額_nud.ForeColor = Color.Black : 金額大寫_tb.BackColor = Color.White : 金額大寫_tb.ForeColor = Color.Black 內容_tb.BackColor = Color.White : 內容_tb.ForeColor = Color.Black : 支付對象_tb.BackColor = Color.White : 支付對象_tb.ForeColor = Color.Black 第二層_cb.BackColor = Color.White : 第二層_cb.ForeColor = Color.Black : 第三層_cb.BackColor = Color.White : 第三層_cb.ForeColor = Color.Black 申請人_tb.BackColor = Color.White : 申請人_tb.ForeColor = Color.Black : 年份2_cb.BackColor = Color.White : 年份2_cb.ForeColor = Color.Black 月份2_cb.BackColor = Color.White : 月份2_cb.ForeColor = Color.Black : 審核人_tb.BackColor = Color.White : 審核人_tb.ForeColor = Color.Black 營行帳號_tb.BackColor = Color.White : 營行帳號_tb.ForeColor = Color.Black : 支付銀行_tb.BackColor = Color.White : 支付銀行_tb.ForeColor = Color.Black 銀行支行_tb.BackColor = Color.White : 銀行支行_tb.ForeColor = Color.Black : 檢查人_tb.BackColor = Color.White : 檢查人_tb.ForeColor = Color.Black 主管_tb.BackColor = Color.White : 主管_tb.ForeColor = Color.Black 重選部門_bt.BackColor = Color.White : 開立收支單_bt.BackColor = Color.White : 申請完成_bt.BackColor = Color.White : 刪除收支單_bt.BackColor = Color.White 列印成EXCEL_bt.BackColor = Color.White : 審核通過_bt.BackColor = Color.White : 單據作廢_bt.BackColor = Color.White : 檢查人_bt.BackColor = Color.White 主管_bt.BackColor = Color.White 財務收支單_dgv.EnableHeadersVisualStyles = True : 財務收支單_dgv.BackgroundColor = Color.White : 財務收支單_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.Black 財務收支單_dgv.DefaultCellStyle.BackColor = Color.White : 財務收支單_dgv.DefaultCellStyle.ForeColor = Color.Black Else Me.BackColor = Color.Black 財務單號_lb.ForeColor = Color.White : Label1.ForeColor = Color.White : Label2.ForeColor = Color.White : 補單_cb.ForeColor = Color.White Label3.ForeColor = Color.White : Label4.ForeColor = Color.White : Label5.ForeColor = Color.White : 會計科目_lb.ForeColor = Color.White Label6.ForeColor = Color.White : Label7.ForeColor = Color.White : Label8.ForeColor = Color.White : Label9.ForeColor = Color.White Label10.ForeColor = Color.White : Label11.ForeColor = Color.White : Label12.ForeColor = Color.White : Label13.ForeColor = Color.White Label14.ForeColor = Color.White : HX_ch.ForeColor = Color.White : PGS_ch.ForeColor = Color.White : ALL_ch.ForeColor = Color.White Label18.ForeColor = Color.White : Label17.ForeColor = Color.White : Label15.ForeColor = Color.White : Label16.ForeColor = Color.White Label19.ForeColor = Color.White 單號_tb.BackColor = Color.DimGray : 單號_tb.ForeColor = Color.White : 部門選單_cb.BackColor = Color.DimGray : 部門選單_cb.ForeColor = Color.White 申請金額_nud.BackColor = Color.DimGray : 申請金額_nud.ForeColor = Color.White : 金額大寫_tb.BackColor = Color.DimGray : 金額大寫_tb.ForeColor = Color.White 內容_tb.BackColor = Color.DimGray : 內容_tb.ForeColor = Color.White : 支付對象_tb.BackColor = Color.DimGray : 支付對象_tb.ForeColor = Color.White 第二層_cb.BackColor = Color.DimGray : 第二層_cb.ForeColor = Color.White : 第三層_cb.BackColor = Color.DimGray : 第三層_cb.ForeColor = Color.White 申請人_tb.BackColor = Color.DimGray : 申請人_tb.ForeColor = Color.White : 年份2_cb.BackColor = Color.DimGray : 年份2_cb.ForeColor = Color.White 月份2_cb.BackColor = Color.DimGray : 月份2_cb.ForeColor = Color.White : 審核人_tb.BackColor = Color.DimGray : 審核人_tb.ForeColor = Color.White 營行帳號_tb.BackColor = Color.DimGray : 營行帳號_tb.ForeColor = Color.White : 支付銀行_tb.BackColor = Color.DimGray : 支付銀行_tb.ForeColor = Color.White 銀行支行_tb.BackColor = Color.DimGray : 銀行支行_tb.ForeColor = Color.White : 檢查人_tb.BackColor = Color.DimGray : 檢查人_tb.ForeColor = Color.White 主管_tb.BackColor = Color.DimGray : 主管_tb.ForeColor = Color.White 重選部門_bt.BackColor = Color.DimGray : 開立收支單_bt.BackColor = Color.DimGray : 申請完成_bt.BackColor = Color.DimGray : 刪除收支單_bt.BackColor = Color.DimGray 列印成EXCEL_bt.BackColor = Color.DimGray : 審核通過_bt.BackColor = Color.DimGray : 單據作廢_bt.BackColor = Color.DimGray : 檢查人_bt.BackColor = Color.DimGray 主管_bt.BackColor = Color.DimGray 財務收支單_dgv.EnableHeadersVisualStyles = False : 財務收支單_dgv.BackgroundColor = Color.DimGray : 財務收支單_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.White 財務收支單_dgv.ColumnHeadersDefaultCellStyle.BackColor = Color.Black : 財務收支單_dgv.DefaultCellStyle.BackColor = Color.Black 財務收支單_dgv.DefaultCellStyle.ForeColor = Color.White End If End Sub End Class