Public Class 銷售發票 Dim xlApp As Microsoft.Office.Interop.Excel.Application ReadOnly xlBook As Microsoft.Office.Interop.Excel.Workbook Dim xlSheet As Microsoft.Office.Interop.Excel.Worksheet Private Sub Set_天心銷售單() Dim ds1 As New DataSet 清單1_dgv.DataSource = Nothing : ds1.Clear() 清單1_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing 清單1_dgv.ColumnHeadersHeight = 25 清單1_dgv.AllowUserToAddRows = False SQL_天心銷售單("已轉發票") da1.Fill(ds1) : 清單1_dgv.DataSource = ds1.Tables(0) : conn.Close() 清單1_dgv.Columns(0).FillWeight = 100 : 清單1_dgv.Columns(0).ReadOnly = True For I As Integer = 1 To 14 : 清單1_dgv.Columns(I).Visible = False : Next End Sub Private Sub 清單1_dgv_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles 清單1_dgv.RowPostPaint For I As Integer = 0 To 清單1_dgv.Rows.Count - 1 If 清單1_dgv.Rows(I).Cells("還未完單").Value.ToString = "" Then : 清單1_dgv.Rows(I).DefaultCellStyle.BackColor = Color.LightGreen : End If Next End Sub Private Sub Set_天心受訂明細() Dim ds1 As New DataSet 清單1_1_dgv.DataSource = Nothing : ds1.Clear() 清單1_1_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing 清單1_1_dgv.ColumnHeadersHeight = 40 清單1_1_dgv.AllowUserToAddRows = False SQL_天心銷售單明細(訂單號_tb.Text, "已轉發票") da1.Fill(ds1) : 清單1_1_dgv.DataSource = ds1.Tables(0) : conn.Close() 清單1_1_dgv.Columns(0).Visible = False : 清單1_1_dgv.Columns(1).FillWeight = 30 : 清單1_1_dgv.Columns(3).FillWeight = 80 : 清單1_1_dgv.Columns(5).FillWeight = 40 清單1_1_dgv.Columns(2).Visible = False : 清單1_1_dgv.Columns(6).FillWeight = 40 : 清單1_1_dgv.Columns(7).FillWeight = 40 : 清單1_1_dgv.Columns(8).FillWeight = 60 清單1_1_dgv.Columns(10).Visible = False : 清單1_1_dgv.Columns(11).FillWeight = 40 : 清單1_1_dgv.Columns(12).FillWeight = 60 : 清單1_1_dgv.Columns(13).FillWeight = 60 清單1_1_dgv.Columns(9).FillWeight = 60 清單1_1_dgv.Columns(5).DefaultCellStyle.Format = "#,##0" : 清單1_1_dgv.Columns(7).DefaultCellStyle.Format = "#,##0.00" 清單1_1_dgv.Columns(8).DefaultCellStyle.Format = "#,##0.00" 清單1_1_dgv.Columns(5).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight 清單1_1_dgv.Columns(5).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter 清單1_1_dgv.Columns(6).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter 清單1_1_dgv.Columns(6).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter 清單1_1_dgv.Columns(7).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight 清單1_1_dgv.Columns(7).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter 清單1_1_dgv.Columns(8).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight 清單1_1_dgv.Columns(8).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter 總數量_lb.Text = "0" : 總金額_lb.Text = "0" For I As Integer = 0 To 13 : 清單1_1_dgv.Columns(I).ReadOnly = True : Next For I As Integer = 0 To 清單1_1_dgv.Rows.Count - 1 清單1_1_dgv.Rows(I).Cells(1).Value = I + 1 : 清單1_1_dgv.Rows(I).Cells("選擇").Value = False If IsDBNull(清單1_1_dgv.Rows(I).Cells("已轉").Value) Then : 清單1_1_dgv.Rows(I).Cells("已轉").Value = False : End If 總數量_lb.Text = CInt(總數量_lb.Text) + 清單1_1_dgv.Rows(I).Cells("數量").Value 總金額_lb.Text = CInt(總金額_lb.Text) + 清單1_1_dgv.Rows(I).Cells("金額").Value Next 總數量_lb.Text = Strings.Format(CInt(總數量_lb.Text), "#,##0") : 總金額_lb.Text = Strings.Format(CInt(總金額_lb.Text), "#,##0") End Sub Private Sub Set_銷售單() Dim ds1 As New DataSet 清單2_dgv.DataSource = Nothing : ds1.Clear() 清單2_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing 清單2_dgv.ColumnHeadersHeight = 25 清單2_dgv.AllowUserToAddRows = False SQL_銷售單() da1.Fill(ds1) : 清單2_dgv.DataSource = ds1.Tables(0) : conn.Close() 清單2_dgv.Columns(0).FillWeight = 100 : 清單2_dgv.Columns(0).ReadOnly = True For I As Integer = 1 To 16 : 清單2_dgv.Columns(I).Visible = False : Next End Sub Private Sub Set_銷售單明細() Set_銷售單_描述() : Dim ds1 As New DataSet 清單2_1_dgv.DataSource = Nothing : ds1.Clear() 清單2_1_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing 清單2_1_dgv.ColumnHeadersHeight = 25 清單2_1_dgv.AllowUserToAddRows = False SQL_銷售單明細(送貨單號_tb.Text) da1.Fill(ds1) : 清單2_1_dgv.DataSource = ds1.Tables(0) : conn.Close() 清單2_1_dgv.Columns(0).FillWeight = 25 : 清單2_1_dgv.Columns(3).FillWeight = 65 : 清單2_1_dgv.Columns(5).FillWeight = 50 : 清單2_1_dgv.Columns(1).FillWeight = 80 清單2_1_dgv.Columns(6).FillWeight = 40 : 清單2_1_dgv.Columns(7).FillWeight = 60 : 清單2_1_dgv.Columns(8).Visible = False : 清單2_1_dgv.Columns(2).FillWeight = 110 清單2_1_dgv.Columns(9).Visible = False : 清單2_1_dgv.Columns(10).Visible = False : 清單2_1_dgv.Columns(4).FillWeight = 65 : 清單2_1_dgv.Columns("件號").Visible = False 清單2_1_dgv.Columns(7).DefaultCellStyle.Format = "#,##0" : 清單2_1_dgv.Columns(6).DefaultCellStyle.Format = "#,##0.00" 清單2_1_dgv.Columns(6).DefaultCellStyle.Format = "#,##0.00" 清單2_1_dgv.Columns(7).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight 清單2_1_dgv.Columns(7).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter 清單2_1_dgv.Columns(5).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight 清單2_1_dgv.Columns(5).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter 清單2_1_dgv.Columns(6).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight 清單2_1_dgv.Columns(6).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter 清單2_1_dgv.EditMode = DataGridViewEditMode.EditOnEnter 總數量a_lb.Text = "0" : 總金額a_lb.Text = "0" For I As Integer = 0 To 8 : 清單2_1_dgv.Columns(I).ReadOnly = True : Next : 清單2_1_dgv.Columns(2).ReadOnly = False For I As Integer = 0 To 清單2_1_dgv.Rows.Count - 1 清單2_1_dgv.Rows(I).Cells(0).Value = I + 1 : 清單2_1_dgv.Rows(I).Cells("選擇").Value = False 總數量a_lb.Text = CInt(總數量a_lb.Text) + 清單2_1_dgv.Rows(I).Cells("Quantity").Value 總金額a_lb.Text = CInt(總金額a_lb.Text) + 清單2_1_dgv.Rows(I).Cells("Amount").Value If 清單2_1_dgv.Rows(I).Cells("Description").Value.ToString = "" And 清單2_1_dgv.Rows(I).Cells("件號").Value.ToString <> "" Then Dim 比對 As Boolean = False For J As Integer = 0 To 清單3_dgv.Rows.Count - 1 If 清單2_1_dgv.Rows(I).Cells("件號").Value.ToString = 清單3_dgv.Rows(J).Cells("對方貨號").Value.ToString Then 清單2_1_dgv.Rows(I).Cells("Description").Value = 清單3_dgv.Rows(J).Cells("描述").Value.ToString : 比對 = True : Exit For End If Next If 比對 = False Then 清單2_1_dgv.Rows(I).Cells("Description").Value = "[" & 清單2_1_dgv.Rows(I).Cells("件號").Value.ToString & "]" End If End If Next 總數量a_lb.Text = Strings.Format(CInt(總數量a_lb.Text), "#,##0") : 總金額a_lb.Text = Strings.Format(CInt(總金額a_lb.Text), "#,##0") : 大寫轉換() 總數量b_lb.Text = Strings.Format(CInt(總數量a_lb.Text), "#,##0") End Sub Private Sub Set_銷售單_描述() Dim ds1 As New DataSet 清單3_dgv.DataSource = Nothing : ds1.Clear() 清單3_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing 清單3_dgv.ColumnHeadersHeight = 25 清單3_dgv.AllowUserToAddRows = False SQL_銷售單明細_描述() da1.Fill(ds1) : 清單3_dgv.DataSource = ds1.Tables(0) : conn.Close() End Sub Private Sub 清單1_dgv_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles 清單1_dgv.CellClick If e.RowIndex = -1 Then : Else 訂單號_tb.Text = 清單1_dgv.Rows(e.RowIndex).Cells("受訂單號").Value.ToString : 受訂日期_dtp.Value = 清單1_dgv.Rows(e.RowIndex).Cells("受訂日期").Value.ToString 預交日期_dtp.Value = 清單1_dgv.Rows(e.RowIndex).Cells("預交日期").Value.ToString : 客戶編號_tb.Text = 清單1_dgv.Rows(e.RowIndex).Cells("客戶編號").Value.ToString 客戶名稱_tb.Text = 清單1_dgv.Rows(e.RowIndex).Cells("客戶名稱").Value.ToString : 統一編號_tb.Text = 清單1_dgv.Rows(e.RowIndex).Cells("統一編號").Value.ToString 連絡電話_tb.Text = 清單1_dgv.Rows(e.RowIndex).Cells("連絡電話").Value.ToString : 送貨地址_tb.Text = 清單1_dgv.Rows(e.RowIndex).Cells("送貨地址").Value.ToString 傳真_tb.Text = 清單1_dgv.Rows(e.RowIndex).Cells("傳真").Value.ToString : 經辦業務_tb.Text = 清單1_dgv.Rows(e.RowIndex).Cells("經辦業務").Value.ToString 交易方式_tb.Text = 清單1_dgv.Rows(e.RowIndex).Cells("交易方式").Value.ToString : 備註_tb.Text = 清單1_dgv.Rows(e.RowIndex).Cells("備註").Value.ToString 幣別_tb.Text = 清單1_dgv.Rows(e.RowIndex).Cells("幣別").Value.ToString : 匯率_tb.Text = 清單1_dgv.Rows(e.RowIndex).Cells("匯率").Value.ToString Set_天心受訂明細() End If End Sub Private Sub 清單_dgv_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles 清單1_1_dgv.CellClick If e.RowIndex = -1 Then : Else If 清單1_1_dgv.Rows(e.RowIndex).Cells("已轉").Value = False Then If 清單1_1_dgv.Rows(e.RowIndex).Cells("選擇").Value = False Then 清單1_1_dgv.Rows(e.RowIndex).Cells("選擇").Value = True Else : 清單1_1_dgv.Rows(e.RowIndex).Cells("選擇").Value = False : End If End If End If End Sub Private Sub 清單_dgv_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles 清單1_1_dgv.RowPostPaint For i As Integer = 0 To 清單1_1_dgv.Rows.Count - 1 If 清單1_1_dgv("選擇", i).Value = True Then 清單1_1_dgv.Rows(i).DefaultCellStyle.BackColor = Color.LightGreen Else : 清單1_1_dgv.Rows(i).DefaultCellStyle.BackColor = Color.White : End If Next End Sub Private Sub 清單2_dgv_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles 清單2_dgv.CellClick If e.RowIndex = -1 Then : Else 送貨單號_tb.Text = 清單2_dgv.Rows(e.RowIndex).Cells("送貨單號").Value.ToString : 客戶資訊_tb.Text = 清單2_dgv.Rows(e.RowIndex).Cells("客戶基本資料").Value.ToString 客戶名稱_cb.Text = 清單2_dgv.Rows(e.RowIndex).Cells("客戶名稱").Value.ToString : 出貨日期_dtp.Value = 清單2_dgv.Rows(e.RowIndex).Cells("出貨日期").Value.ToString 開單人員_tb.Text = 清單2_dgv.Rows(e.RowIndex).Cells("經辦人員").Value.ToString : 出貨地點_tb.Text = 清單2_dgv.Rows(e.RowIndex).Cells("出貨地點").Value.ToString 運送到_cb.Text = 清單2_dgv.Rows(e.RowIndex).Cells("運送到").Value.ToString : 運送方式_tb.Text = 清單2_dgv.Rows(e.RowIndex).Cells("運送方式").Value.ToString 出貨方_tb.Text = 清單2_dgv.Rows(e.RowIndex).Cells("出貨方").Value.ToString : 貿易方式_cb.Text = 清單2_dgv.Rows(e.RowIndex).Cells("貿易通則").Value.ToString 出貨備註_tb.Text = 清單2_dgv.Rows(e.RowIndex).Cells("出貨備註").Value.ToString : 貨櫃_cb.Text = 清單2_dgv.Rows(e.RowIndex).Cells("貨櫃").Value.ToString 貨櫃ID_tb.Text = 清單2_dgv.Rows(e.RowIndex).Cells("貨櫃ID").Value.ToString : 貨櫃封條_tb.Text = 清單2_dgv.Rows(e.RowIndex).Cells("貨櫃封條").Value.ToString 棧板數_tb.Text = 清單2_dgv.Rows(e.RowIndex).Cells("棧板數量").Value.ToString : 製造_tb.Text = 清單2_dgv.Rows(e.RowIndex).Cells("製造").Value.ToString 品牌_tb.Text = 清單2_dgv.Rows(e.RowIndex).Cells("品牌").Value.ToString Set_銷售單明細() End If End Sub Private Sub 清單2_1_dgv_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 清單2_1_dgv.MouseUp Dim 位置Y As Integer = 清單2_1_dgv.SelectedCells(0).ColumnIndex : Dim 位置 As Integer = 清單2_1_dgv.SelectedCells(0).RowIndex If 位置Y <> 2 Then If 清單2_1_dgv.Rows(位置).Cells("選擇").Value = False Then : 清單2_1_dgv.Rows(位置).Cells("選擇").Value = True Else : 清單2_1_dgv.Rows(位置).Cells("選擇").Value = False : End If End If End Sub Private Sub 清單2_1_dgv_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles 清單2_1_dgv.RowPostPaint For i As Integer = 0 To 清單2_1_dgv.Rows.Count - 1 If 清單2_1_dgv("選擇", i).Value = True Then 清單2_1_dgv.Rows(i).DefaultCellStyle.BackColor = Color.LightGreen Else : 清單2_1_dgv.Rows(i).DefaultCellStyle.BackColor = Color.White : End If Next End Sub Private Sub 語言_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 語言_cb.SelectedIndexChanged If 首次進入 = False Then If 語言_cb.Text = "中文" Then : 出貨備註_lb.Text = "出貨備註 :" : 總數量1_lb.Text = "總數量 :" : 總金額1_lb.Text = "總金額 :" 公司名稱_lb.Text = "翰德精密工業股份有限公司" : 送貨單號_lb.Text = "送貨單號 :" : 出貨日期_lb.Text = "出貨日期 :" 地址_lb.Text = "屏東縣長治鄉神農東路22號 " & vbCrLf & "郵遞區號 : 908126 " & vbCrLf & "台灣" 客戶資料_lb.Text = "客戶基本資料 :" : 經辦_lb.Text = "經辦人員 :" : 出貨地點_lb.Text = "出貨地點 :" 運送到_lb.Text = "運送到 :" : 運送方式_lb.Text = "運送方式 :" : 出貨方_lb.Text = "出貨方 :" : 貿易方式_lb.Text = "貿易通則 :" 金額大寫_lb.Text = "總金額 :" : 貨櫃_lb.Text = "貨櫃 :" : 貨櫃ID_lb.Text = "貨櫃ID :" : 貨櫃封條_lb.Text = "貨櫃封條 :" 總數量2_lb.Text = "總數 :" : 製造_lb.Text = "製造 :" : 品牌_lb.Text = "品牌 :" : 統編_lb.Text = "統編 :" Else : 出貨備註_lb.Text = "Ship on/about:" : 總數量1_lb.Text = "Quantity Total :" : 總金額1_lb.Text = "Amount Total :" 公司名稱_lb.Text = "HAN TEC PRECISION INDUSTRY CO., LTD." : 送貨單號_lb.Text = "Delivery #" : 出貨日期_lb.Text = "Shipping Date:" 地址_lb.Text = "NO. 22, SHENNONG E. RD., CHANGZHI TOWNSHIP, " & vbCrLf & "PINGTUNG COUNTY " & vbCrLf & "908126 " & vbCrLf & "Taiwan" 客戶資料_lb.Text = "For account and risk of Messrs.:" : 經辦_lb.Text = "Salesperson:" : 出貨地點_lb.Text = "Ship From:" 運送到_lb.Text = "Ship To:" : 運送方式_lb.Text = "Ship By:" : 出貨方_lb.Text = "Ship Per:" : 貿易方式_lb.Text = "Incoterm:" 金額大寫_lb.Text = "Say Total :" : 貨櫃_lb.Text = "Container :" : 貨櫃ID_lb.Text = "Container ID :" : 貨櫃封條_lb.Text = "Container Seal :" 總數量2_lb.Text = "Total :" : 製造_lb.Text = "Mark :" : 品牌_lb.Text = "BRAND :" : 統編_lb.Text = "VAT : " End If : 大寫轉換() End If End Sub Private Sub 客戶名稱_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 客戶名稱_cb.SelectedIndexChanged 客戶資訊_cb.SelectedIndex = 客戶名稱_cb.SelectedIndex : 客戶資訊_tb.Text = 客戶資訊_cb.Text End Sub Private Sub 下拉清單刷新() SQL_銷售_客戶名稱() 客戶名稱_cb.Items.Clear() : 客戶資訊_cb.Items.Clear() : While (dr1.Read()) : 客戶名稱_cb.Items.Add(dr1("客戶名稱")) : 客戶資訊_cb.Items.Add(dr1("客戶基本資料")) : End While SQL_銷售_運送到() : 運送到_cb.Items.Clear() : While (dr1.Read()) : 運送到_cb.Items.Add(dr1("運送到")) : End While SQL_銷售_貿易方式() : 貿易方式_cb.Items.Clear() : While (dr1.Read()) : 貿易方式_cb.Items.Add(dr1("貿易通則")) : End While SQL_銷售_貨櫃() : 貨櫃_cb.Items.Clear() : While (dr1.Read()) : 貨櫃_cb.Items.Add(dr1("貨櫃")) : End While SQL_銷售_品牌() : 品牌_tb.Items.Clear() : While (dr1.Read()) : 品牌_tb.Items.Add(dr1("品牌")) : End While End Sub Private Sub 銷售單據列印_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.MdiParent = HT_ERP_SELLINGPI : Me.WindowState = 2 : Me.AutoScroll = True 首次進入 = True 開單人員_tb.Text = gUserName : 語言_cb.SelectedIndex = 0 : 送貨單號_tb.ReadOnly = True : 客戶資訊_cb.SendToBack() : 清單3_dgv.SendToBack() 貨櫃_cb.Text = "" : 貿易方式_cb.Text = "" : 出貨備註_tb.Text = "" : 送貨單號_tb.Text = "" : 出貨日期_dtp.Value = Today() : 運送到_cb.Text = "" : 運送方式_tb.Text = "" 棧板數_tb.Text = "0" : 品牌_tb.Text = "" : 客戶資訊_tb.Text = "" : 客戶名稱_cb.Text = "" : 貨櫃ID_tb.Text = "" : 貨櫃封條_tb.Text = "" If gUserName = "系統管理員" Then : 導入受訂單_bt.Visible = True : Else : 導入受訂單_bt.Visible = True : End If 首次進入 = False End Sub Private Sub 銷售單據列印_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown Set_天心銷售單() : Set_銷售單() : 下拉清單刷新() End Sub Private Sub 導入受訂單_bt_Click(sender As Object, e As EventArgs) Handles 導入受訂單_bt.Click With 開啟檔案 .Title = "選擇 Excel 檔案" .Filter = "Excel 檔案 (*.xls;*.xlsx)|*.xls;*.xlsx" .FilterIndex = 1 ' 預設選項 .RestoreDirectory = True ' 關閉後回到先前的資料夾 .Multiselect = False ' 限制只能選擇單一檔案 End With : Dim file_name As String If 開啟檔案.ShowDialog = Windows.Forms.DialogResult.OK Then Try file_name = 開啟檔案.FileName xlApp = CreateObject("Excel.Application") xlApp.DisplayAlerts = True xlApp.Visible = True xlApp.Workbooks.Open(file_name) xlSheet = xlApp.Worksheets(1) : xlSheet.Activate() Dim 檔案 As String = xlSheet.Cells(1, 2).value If 檔案 = "受 訂 單" Then 訂單號_tb.Text = Strings.Mid(xlSheet.Cells(6, 7).value, 6, 50) : 受訂日期_dtp.Value = xlSheet.Cells(2, 2).value 預交日期_dtp.Value = Strings.Mid(xlSheet.Cells(7, 7).value, 6, 50) : 客戶編號_tb.Text = Strings.Mid(xlSheet.Cells(6, 2).value, 6, 4) 客戶名稱_tb.Text = Strings.Mid(xlSheet.Cells(6, 2).value, 10, 50) : 統一編號_tb.Text = Strings.Mid(xlSheet.Cells(7, 2).value, 6, 50) 連絡電話_tb.Text = Strings.Mid(xlSheet.Cells(8, 2).value, 6, 50) : 送貨地址_tb.Text = Strings.Mid(xlSheet.Cells(9, 2).value, 6, 50) 傳真_tb.Text = Strings.Mid(xlSheet.Cells(8, 4).value, 6, 50) : 經辦業務_tb.Text = Strings.Mid(xlSheet.Cells(8, 7).value, 11, 50) 交易方式_tb.Text = Strings.Mid(xlSheet.Cells(42, 2).value, 6, 100) : 備註_tb.Text = Strings.Mid(xlSheet.Cells(43, 2).value, 9, 100) 幣別_tb.Text = xlSheet.Cells(3, 3).value : 匯率_tb.Text = xlSheet.Cells(3, 4).value xlApp.Visible = False If 訂單號_tb.Text <> "" Then SQL_受訂控制表查詢(訂單號_tb.Text) If dr1.Read Then MsgBox("該檔案已經存在系統中,不需要重複導入!!") : xlApp.Visible = True : xlApp.Quit() : xlApp = Nothing : Exit Sub Else SQL_受訂控制表新增(訂單號_tb.Text, Strings.Format(受訂日期_dtp.Value, "yyyy/MM/dd"), Strings.Format(預交日期_dtp.Value, "yyyy/MM/dd"), 客戶編號_tb.Text, 客戶名稱_tb.Text, 統一編號_tb.Text, 連絡電話_tb.Text, 送貨地址_tb.Text, 傳真_tb.Text, 經辦業務_tb.Text, 交易方式_tb.Text, 備註_tb.Text, 幣別_tb.Text, 匯率_tb.Text) End If Dim NUM1 As Integer : Dim 流水號 As String = "" SQL_受訂明細表刪除(訂單號_tb.Text) : SQL_受訂明細表查詢() If dr1.Read Then : NUM1 = Strings.Right(dr1("流水號"), 5) : Else : NUM1 = 0 : End If For i As Integer = 11 To 99999 Dim 判斷 As String = xlSheet.Cells(i, 2).value : If 判斷 = "" Then : Exit For : End If NUM1 += 1 If NUM1 < 10 Then : 流水號 = "SO-" & Strings.Format(Today(), "yyyyMMdd") & "-0000" & NUM1 ElseIf NUM1 > 9 And NUM1 < 100 Then : 流水號 = "SO-" & Strings.Format(Today(), "yyyyMMdd") & "-000" & NUM1 ElseIf NUM1 > 99 And NUM1 < 1000 Then : 流水號 = "SO-" & Strings.Format(Today(), "yyyyMMdd") & "-00" & NUM1 ElseIf NUM1 > 999 And NUM1 < 10000 Then : 流水號 = "SO-" & Strings.Format(Today(), "yyyyMMdd") & "-0" & NUM1 ElseIf NUM1 > 9999 Then : 流水號 = "SO-" & Strings.Format(Today(), "yyyyMMdd") & "-" & NUM1 : End If SQL_受訂明細表新增(流水號, 訂單號_tb.Text, xlSheet.Cells(i, 2).value, xlSheet.Cells(i, 3).value, xlSheet.Cells(i, 4).value, xlSheet.Cells(i, 5).value, xlSheet.Cells(i, 6).value, xlSheet.Cells(i, 7).value, xlSheet.Cells(i, 8).value, xlSheet.Cells(i, 10).value, xlSheet.Cells(i, 11).value) Next Else : xlApp.Visible = True : xlApp.Quit() : xlApp = Nothing : MsgBox("導入的資料有問題,請重新確認,或是通知系統管理員!!") : Exit Sub : End If Else : xlApp.Visible = True : xlApp.Quit() : xlApp = Nothing : MsgBox("您選擇的檔案並不是[受訂單],該介面目前不能導入非受訂單的檔案!!") : Exit Sub : End If Catch ex As Exception : MsgBox(ex.Message) : End Try xlApp.Visible = True : xlApp.Quit() : xlApp = Nothing : MsgBox("資料導入完成") : Set_天心銷售單() End If End Sub Private Sub 刪除受訂單_bt_Click(sender As Object, e As EventArgs) Handles 刪除受訂單_bt.Click If CC(4) = False Then : MsgBox("您的帳號沒有刪除資料的權限!!") : Else If 訂單號_tb.Text <> "" Then : Dim 不可刪除 As Boolean = False For I As Integer = 0 To 清單1_1_dgv.Rows.Count - 1 : If 清單1_1_dgv.Rows(I).Cells("已轉").Value = True Then : 不可刪除 = True : Exit For : End If : Next If 不可刪除 = False Then Dim result As DialogResult = MessageBox.Show("請再次確認您是否要從外掛系統中刪除受訂單 [ " & 訂單號_tb.Text & "] 的資料?", "請選擇", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If result = DialogResult.Yes Then SQL_受訂控制表刪除(訂單號_tb.Text) : SQL_受訂明細表刪除(訂單號_tb.Text) : MsgBox("資料刪除完成!!") Set_天心銷售單() : 清單1_1_dgv.DataSource = Nothing 訂單號_tb.Text = "" : 受訂日期_dtp.Value = Today() : 預交日期_dtp.Value = Today() : 客戶編號_tb.Text = "" : 客戶名稱_tb.Text = "" : 統一編號_tb.Text = "" 連絡電話_tb.Text = "" : 送貨地址_tb.Text = "" : 傳真_tb.Text = "" : 經辦業務_tb.Text = "" : 交易方式_tb.Text = "" : 備註_tb.Text = "" End If Else : MsgBox("該受訂單的資料已經有引用在 COMMERCIAL INVOICE 無法刪除!!") : End If Else : MsgBox("請選擇要刪除的受訂單!!") : End If End If End Sub Private Sub 重新讀取_bt_Click(sender As Object, e As EventArgs) Handles 重新讀取_bt.Click Set_天心銷售單() : 大寫轉換() End Sub Private Sub 新增_bt_Click(sender As Object, e As EventArgs) Handles 新增_bt.Click 貨櫃_cb.Text = "" : 貿易方式_cb.Text = "" : 出貨備註_tb.Text = "" : 送貨單號_tb.Text = "" : 出貨日期_dtp.Value = Today() : 運送到_cb.Text = "" : 運送方式_tb.Text = "" 棧板數_tb.Text = "0" : 品牌_tb.Text = "" : 客戶資訊_tb.Text = "" : 客戶名稱_cb.Text = "" : 送貨單號_tb.ReadOnly = False : 貨櫃ID_tb.Text = "" : 貨櫃封條_tb.Text = "" 清單2_1_dgv.DataSource = Nothing End Sub Private Sub 存檔_bt_Click(sender As Object, e As EventArgs) Handles 存檔_bt.Click If CC(5) = False Then : MsgBox("您的帳號沒有編輯資料的權限!!") : Else Dim 不可存檔 As Boolean = False : Dim 通知(12) As String If 送貨單號_tb.Text = "" Then : 通知(0) = 送貨單號_lb.Text & "," : 不可存檔 = True : End If If 客戶資訊_tb.Text = "" Then : 通知(1) = 客戶資料_lb.Text & "," : 不可存檔 = True : End If If 客戶名稱_cb.Text = "" Then : 通知(2) = 客戶資料_lb.Text & "(下方的夏拉清單要填入客戶名稱)," : 不可存檔 = True : End If If 運送到_cb.Text = "" Then : 通知(3) = 運送到_lb.Text & "," : 不可存檔 = True : End If If 運送方式_tb.Text = "" Then : 通知(4) = 運送方式_lb.Text & "," : 不可存檔 = True : End If If 貿易方式_cb.Text = "" Then : 通知(5) = 貿易方式_lb.Text & "," : 不可存檔 = True : End If If 貨櫃_cb.Text = "" Then : 通知(6) = 貨櫃_lb.Text & "," : 不可存檔 = True : End If If 棧板數_tb.Text = "" Then : 通知(7) = PLT_lb.Text & "," : 不可存檔 = True : End If If 品牌_tb.Text = "" Then : 通知(8) = 品牌_lb.Text & "," : 不可存檔 = True : End If If 出貨備註_tb.Text = "" Then : 通知(9) = 出貨備註_lb.Text & "," : 不可存檔 = True : End If If 出貨地點_tb.Text = "" Then : 通知(10) = 出貨地點_lb.Text & "," : 不可存檔 = True : End If If 出貨方_tb.Text = "" Then : 通知(11) = 出貨方_tb.Text & "," : 不可存檔 = True : End If If 製造_tb.Text = "" Then : 通知(12) = 製造_tb.Text & "," : 不可存檔 = True : End If If 不可存檔 = False Then SQL_銷售發票控制表查詢(送貨單號_tb.Text) If dr1.Read Then SQL_銷售發票控制表修改(送貨單號_tb.Text, 客戶資訊_tb.Text, 客戶名稱_cb.Text, Strings.Format(出貨日期_dtp.Value, "yyyy/MM/dd"), 開單人員_tb.Text, 出貨地點_tb.Text, 運送到_cb.Text, 運送方式_tb.Text, 出貨方_tb.Text, 貿易方式_cb.Text, 出貨備註_tb.Text, 貨櫃_cb.Text, 貨櫃ID_tb.Text, 貨櫃封條_tb.Text, 棧板數_tb.Text, 製造_tb.Text, 品牌_tb.Text) Else SQL_銷售發票控制表新增(送貨單號_tb.Text, 客戶資訊_tb.Text, 客戶名稱_cb.Text, Strings.Format(出貨日期_dtp.Value, "yyyy/MM/dd"), 開單人員_tb.Text, 出貨地點_tb.Text, 運送到_cb.Text, 運送方式_tb.Text, 出貨方_tb.Text, 貿易方式_cb.Text, 出貨備註_tb.Text, 貨櫃_cb.Text, 貨櫃ID_tb.Text, 貨櫃封條_tb.Text, 棧板數_tb.Text, 製造_tb.Text, 品牌_tb.Text) End If For i As Integer = 0 To 清單2_1_dgv.Rows.Count - 1 SQL_銷售發票明細表修改(清單2_1_dgv.Rows(i).Cells("流水號").Value.ToString, 清單2_1_dgv.Rows(i).Cells("Description").Value.ToString) Next 送貨單號_tb.ReadOnly = True : MsgBox("存檔完成!!") : Set_銷售單() : Set_銷售單明細() : 下拉清單刷新() Else : MsgBox(通知(0) & 通知(1) & 通知(2) & 通知(3) & 通知(4) & 通知(5) & 通知(6) & 通知(7) & 通知(8) & 通知(9) & 通知(10) & 通知(11) & 通知(12) & "不可以空白,請注意資料完整性!!") End If End If End Sub Private Sub 增加明細_bt_Click(sender As Object, e As EventArgs) Handles 增加明細_bt.Click If 送貨單號_tb.ReadOnly = False Then : MsgBox("存檔後才能操作!!") : Else If CC(5) = False Then : MsgBox("您的帳號沒有編輯資料的權限!!") : Else If 送貨單號_tb.Text = "" Then : MsgBox("沒有選擇 COMMERCIAL INVOICE 無法轉移受訂單明細資料,請先選擇或是新建 COMMERCIAL INVOICE!!") : Else Dim NUM1 As Integer : Dim 流水號 As String = "" : SQL_銷售發票明細表查詢() If dr1.Read Then : NUM1 = Strings.Right(dr1("流水號"), 2) : Else : NUM1 = 0 : End If For I As Integer = 0 To 清單1_1_dgv.Rows.Count - 1 If 清單1_1_dgv.Rows(I).Cells("選擇").Value = True Then NUM1 += 1 If NUM1 < 10 Then : 流水號 = "SU-" & Strings.Format(Today(), "yyyyMMdd") & "-0000" & NUM1 ElseIf NUM1 > 9 And NUM1 < 100 Then : 流水號 = "SU-" & Strings.Format(Today(), "yyyyMMdd") & "-000" & NUM1 ElseIf NUM1 > 99 And NUM1 < 1000 Then : 流水號 = "SU-" & Strings.Format(Today(), "yyyyMMdd") & "00-" & NUM1 ElseIf NUM1 > 999 And NUM1 < 10000 Then : 流水號 = "SU-" & Strings.Format(Today(), "yyyyMMdd") & "0-" & NUM1 ElseIf NUM1 > 9999 Then : 流水號 = "SU-" & Strings.Format(Today(), "yyyyMMdd") & "-" & NUM1 End If SQL_銷售發票明細表新增(流水號, 送貨單號_tb.Text, "[" & 清單1_1_dgv.Rows(I).Cells("產品編號").Value.ToString & "] " & 清單1_1_dgv.Rows(I).Cells("產品名稱").Value.ToString, "", 訂單號_tb.Text, 清單1_1_dgv.Rows(I).Cells("數量").Value.ToString, 清單1_1_dgv.Rows(I).Cells("單價").Value.ToString, 清單1_1_dgv.Rows(I).Cells("金額").Value.ToString, "0", 清單1_1_dgv.Rows(I).Cells("流水號").Value.ToString, 清單1_1_dgv.Rows(I).Cells("貨號").Value.ToString) SQL_受訂明細表轉移標註(清單1_1_dgv.Rows(I).Cells("流水號").Value.ToString, "1", "已轉發票") End If Next : Set_銷售單明細() : Set_天心受訂明細() : Set_天心銷售單() End If End If End If End Sub Private Sub 刪除明細_bt_Click(sender As Object, e As EventArgs) Handles 刪除明細_bt.Click If 送貨單號_tb.ReadOnly = False Then : MsgBox("存檔後才能操作!!") : Else If CC(5) = False Then : MsgBox("您的帳號沒有編輯資料的權限!!") : Else If 送貨單號_tb.Text = "" Then : MsgBox("沒有選擇 COMMERCIAL INVOICE 無法轉移受訂單明細資料,請先選擇 COMMERCIAL INVOICE!!") : Else For I As Integer = 0 To 清單2_1_dgv.Rows.Count - 1 If 清單2_1_dgv.Rows(I).Cells("選擇").Value = True Then SQL_銷售發票明細表刪除(清單2_1_dgv.Rows(I).Cells("流水號").Value.ToString) SQL_受訂明細表轉移標註(清單2_1_dgv.Rows(I).Cells("受定流水號").Value.ToString, "0", "已轉發票") End If Next : Set_銷售單明細() : Set_天心受訂明細() : Set_天心銷售單() : MsgBox("選定的資料已從 COMMERCIAL INVOICE 中撤回受訂單中!!") End If End If End If End Sub Private Sub 刪除發票_bt_Click(sender As Object, e As EventArgs) Handles 刪除發票_bt.Click If CC(4) = False Then : MsgBox("您的帳號沒有刪除資料的權限!!") : Else If 送貨單號_tb.Text = "" Then : MsgBox("沒有選擇 COMMERCIAL INVOICE 無法刪除!!") : Else Dim result As DialogResult = MessageBox.Show("請再次確認您是否要從外掛系統中刪除 COMMERCIAL INVOICE [ " & 送貨單號_tb.Text & "] 的資料?", "請選擇", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If result = DialogResult.Yes Then SQL_銷售發票控制表刪除(送貨單號_tb.Text) For I As Integer = 0 To 清單2_1_dgv.Rows.Count - 1 SQL_銷售發票明細表刪除(清單2_1_dgv.Rows(I).Cells("流水號").Value.ToString) SQL_受訂明細表轉移標註(清單2_1_dgv.Rows(I).Cells("受定流水號").Value.ToString, "0", "已轉發票") Next 貨櫃_cb.Text = "" : 貿易方式_cb.Text = "" : 出貨備註_tb.Text = "" : 送貨單號_tb.Text = "" : 出貨日期_dtp.Value = Today() : 運送到_cb.Text = "" : 運送方式_tb.Text = "" 棧板數_tb.Text = "0" : 品牌_tb.Text = "" : 客戶資訊_tb.Text = "" : 客戶名稱_cb.Text = "" : 貨櫃ID_tb.Text = "" : 貨櫃封條_tb.Text = "" Set_銷售單明細() : Set_天心受訂明細() : Set_天心銷售單() : Set_銷售單() : MsgBox("選定的 COMMERCIAL INVOICE 已經刪除!!") End If End If End If End Sub Private Sub 大寫轉換() Dim 個位(20), 十位(9), 百位(1), 千位(1), 百萬, 十億, 零, 拾, 百, 仟, 萬, 億, 兆, 答案 As String : Dim 數長 As Integer If 語言_cb.Text = "中文" Then 個位(0) = "零" : 個位(1) = "壹" : 個位(2) = "貳" : 個位(3) = "參" : 個位(4) = "肆" : 個位(5) = "伍" : 個位(6) = "陸" : 個位(7) = "柒" : 個位(8) = "捌" : 個位(9) = "玖" 零 = "零" : 拾 = "拾" : 百 = "百" : 仟 = "仟" : 萬 = "萬" : 億 = "億" : 兆 = "兆" Else 個位(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 = CInt(總金額a_lb.Text) : 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 語言_cb.Text <> "中文" Then If CInt(總金額a_lb.Text) < 21 Then : 答案 = 個位(CInt(總金額a_lb.Text)) 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 : 答案 = 個位(CInt(總金額a_lb.Text)) 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 語言_cb.Text = "中文" Then : 金額大寫a_lb.Text = 答案 & " 元整" : Else : 金額大寫a_lb.Text = 答案 & " Rupee" : End If End Sub Private Sub 列印_bt_Click(sender As Object, e As EventArgs) Handles 列印_bt.Click End Sub End Class