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 Imports System.Threading Public Class 形體總表MINI_WALL Private ReadOnly ds, ds1, ds2, ds3, ds4 As New DataSet Private 楦頭最大數, 草圖計算數, 草圖最大數, N1, N2 As Integer Private 位置1, 位置2, 位置3, 位置4, 位置5, 位置6, 位置7, 位置8, 位置9, 位置10 As String Dim xlApp As Application : Dim xlBook As Workbook : Dim xlSheet As Worksheet Private Sub 草圖表清單() 資料完備的鞋樣素描圖清單_dgv.DataSource = Nothing : ds.Clear() 資料完備的鞋樣素描圖清單_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing 資料完備的鞋樣素描圖清單_dgv.ColumnHeadersHeight = 25 資料完備的鞋樣素描圖清單_dgv.AllowUserToAddRows = False SQL_草圖表清單() da.Fill(ds) : 資料完備的鞋樣素描圖清單_dgv.DataSource = ds.Tables(0) : conn.Close() 資料完備的鞋樣素描圖清單_dgv.Columns(0).Width = 120 : 資料完備的鞋樣素描圖清單_dgv.Columns(1).Width = 120 資料完備的鞋樣素描圖清單_dgv.Columns(2).Width = 120 : 資料完備的鞋樣素描圖清單_dgv.Columns(3).Width = 40 資料完備的鞋樣素描圖清單_dgv.Columns(4).Visible = False For i As Integer = 0 To 資料完備的鞋樣素描圖清單_dgv.Rows.Count - 1 資料完備的鞋樣素描圖清單_dgv.Rows(i).Cells("選擇").Value = False Next i End Sub Private Sub Set_清單2() 楦頭清單_dgv.DataSource = Nothing : ds1.Clear() 楦頭清單_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing 楦頭清單_dgv.ColumnHeadersHeight = 25 楦頭清單_dgv.AllowUserToAddRows = False 楦頭清單_dgv.RowTemplate.Height = 60 SQL_清單2() da.Fill(ds1) : 楦頭清單_dgv.DataSource = ds1.Tables(0) : conn.Close() 楦頭清單_dgv.Columns(0).Width = 100 : 楦頭清單_dgv.Columns(1).Width = 70 : 楦頭清單_dgv.Columns(2).Visible = False : 楦頭清單_dgv.Columns(3).Width = 70 : 楦頭清單_dgv.Columns(4).Width = 40 楦頭清單_dgv.EditMode = DataGridViewEditMode.EditOnEnter Dim mycol As DataGridViewImageColumn = 楦頭清單_dgv.Columns("楦頭圖片") mycol.ImageLayout = DataGridViewImageCellLayout.Zoom For i As Integer = 0 To 楦頭清單_dgv.Rows.Count - 1 If 楦頭清單_dgv.Rows(i).Cells("選擇").Value Is DBNull.Value Then 楦頭清單_dgv.Rows(i).Cells("選擇").Value = False End If Next i End Sub Private Sub Set_楦頭清單() 資料完備的楦頭清單_dgv.DataSource = Nothing : ds2.Clear() 資料完備的楦頭清單_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing 資料完備的楦頭清單_dgv.ColumnHeadersHeight = 25 資料完備的楦頭清單_dgv.AllowUserToAddRows = False SQL_楦頭清單() da.Fill(ds2) : 資料完備的楦頭清單_dgv.DataSource = ds2.Tables(0) : conn.Close() For i As Integer = 0 To 資料完備的楦頭清單_dgv.Rows.Count - 1 資料完備的楦頭清單_dgv.Rows(i).Cells("選擇").Value = False Next i 資料完備的楦頭清單_dgv.Columns(0).Width = 120 : 資料完備的楦頭清單_dgv.Columns(1).Visible = False End Sub Private Sub Set_DGV4載入前設定() 鞋樣素描圖清單_dgv.DataSource = Nothing : ds3.Clear() 鞋樣素描圖清單_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing 鞋樣素描圖清單_dgv.ColumnHeadersHeight = 25 鞋樣素描圖清單_dgv.AllowUserToAddRows = False 鞋樣素描圖清單_dgv.RowTemplate.Height = 60 End Sub Private Sub Set_DGV4載入後設定() da.Fill(ds3) : 鞋樣素描圖清單_dgv.DataSource = ds3.Tables(0) : conn.Close() End Sub Private Sub 清單3() Set_DGV4載入前設定() SQL_清單3() Set_DGV4載入後設定() : Set_grid3() End Sub Private Sub Set_grid3() 鞋樣素描圖清單_dgv.Columns(0).Width = 120 : 鞋樣素描圖清單_dgv.Columns(1).Width = 120 : 鞋樣素描圖清單_dgv.Columns(2).Width = 120 鞋樣素描圖清單_dgv.Columns(3).Width = 120 : 鞋樣素描圖清單_dgv.Columns(4).Width = 120 鞋樣素描圖清單_dgv.Columns(5).Width = 40 : 鞋樣素描圖清單_dgv.Columns(6).Visible = False Dim mycol As DataGridViewImageColumn = 鞋樣素描圖清單_dgv.Columns("圖片") mycol.ImageLayout = DataGridViewImageCellLayout.Zoom For i As Integer = 0 To 鞋樣素描圖清單_dgv.Rows.Count - 1 If 鞋樣素描圖清單_dgv.Rows(i).Cells("選擇").Value Is DBNull.Value Then 鞋樣素描圖清單_dgv.Rows(i).Cells("選擇").Value = False End If Next i End Sub Private Sub Set_清單1() 清單_dgv.DataSource = Nothing : ds4.Clear() 清單_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing 清單_dgv.ColumnHeadersHeight = 25 清單_dgv.AllowUserToAddRows = False SQL_清單1() da.Fill(ds4) : 清單_dgv.DataSource = ds4.Tables(0) : conn.Close() 清單_dgv.Columns(0).Width = 100 : 清單_dgv.Columns(1).Width = 60 : 清單_dgv.Columns(2).Width = 140 End Sub Private Sub ComboBox1下拉表單資料載入() SQL_型體控制表() 品牌_cb.Items.Clear() : While (dr.Read()) : 品牌_cb.Items.Add(dr("客戶簡稱")) : End While : conn.Close() End Sub Private Sub ComboBox7下拉表單資料載入() SQL_季節清單() 季節_cb.Items.Clear() : While (dr.Read()) : 季節_cb.Items.Add(dr("SEASON")) : End While : conn.Close() End Sub Private Sub 圖片導入1() SQL_楦頭圖片庫() PictureBox1.Image = Nothing While dr.Read() = True Dim bytes As Byte() = New Byte(-1) {} bytes = DirectCast(dr.Item("楦頭圖片"), Byte()) Dim oStream As New MemoryStream(bytes) PictureBox1.Image = Bitmap.FromStream(oStream) End While conn.Close() PictureBox1.SizeMode = 4 End Sub Private Sub 圖片導入2() SQL_楦頭圖片庫1() PictureBox2.Image = Nothing While dr.Read() = True Dim bytes As Byte() = New Byte(-1) {} bytes = DirectCast(dr.Item("圖片"), Byte()) Dim oStream As New MemoryStream(bytes) PictureBox2.Image = Bitmap.FromStream(oStream) End While conn.Close() PictureBox2.SizeMode = 4 End Sub Private Sub 形體總表MINI_WALL_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.MdiParent = WINPROFIT_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True WINPROFIT_ERP_SYS.WindowState = 2 : ComboBox1下拉表單資料載入() : ComboBox7下拉表單資料載入() : Set_清單1() MiniWall編號_tb.Enabled = False : 選中要刪除的楦頭_tb.Enabled = False : 選中要刪除的鞋樣素描_tb.Enabled = False End Sub Private Sub DataGridView5_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 清單_dgv.CellClick If e.RowIndex = -1 Then : Else MiniWall編號_tb.Text = 清單_dgv.Rows(e.RowIndex).Cells("MW編號").Value : 季節_cb.Text = 清單_dgv.Rows(e.RowIndex).Cells("季節").Value 品牌_cb.Text = 清單_dgv.Rows(e.RowIndex).Cells("品牌").Value Set_清單2() : 選中要刪除的楦頭_tb.Text = "" : 選中要刪除的鞋樣素描_tb.Text = "" End If End Sub Private Sub DataGridView2_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 楦頭清單_dgv.CellClick If e.RowIndex = -1 Then : Else AASS = 楦頭清單_dgv.Rows(e.RowIndex).Cells("楦頭編號").Value 選中要刪除的楦頭_tb.Text = 楦頭清單_dgv.Rows(e.RowIndex).Cells("楦頭編號").Value 清單3() : 選中要刪除的鞋樣素描_tb.Text = "" End If End Sub Private Sub DataGridView4_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 鞋樣素描圖清單_dgv.CellClick If e.RowIndex = -1 Then : Else 選中要刪除的鞋樣素描_tb.Text = 鞋樣素描圖清單_dgv.Rows(e.RowIndex).Cells("鞋樣素描圖編號").Value End If End Sub Private Sub DataGridView3_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 資料完備的楦頭清單_dgv.CellClick If e.RowIndex = -1 Then : Else AASS = 資料完備的楦頭清單_dgv.Rows(e.RowIndex).Cells("楦頭編號").Value 草圖表清單() : 圖片導入1() End If End Sub Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 資料完備的鞋樣素描圖清單_dgv.CellClick If e.RowIndex = -1 Then : Else SSDD = 資料完備的鞋樣素描圖清單_dgv.Rows(e.RowIndex).Cells("鞋樣素描圖編號").Value 圖片導入2() End If End Sub Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 品牌_cb.SelectedIndexChanged Set_楦頭清單() End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles 新增季節清單_bt.Click 清單修改.Close() : 季節清單修改 = True : 清單修改.ShowDialog() : ComboBox7下拉表單資料載入() : 季節清單修改 = False End Sub Private Sub Button29_Click(sender As Object, e As EventArgs) Handles 新增MINIWALL主題_bt.Click If 季節_cb.Text = "" Or 品牌_cb.Text = "" Then MsgBox("季節與品牌沒有選擇") Else SQL_查詢MW編號() If dr.Read() Then : MiniWall編號_tb.Text = dr("MW編號").ToString : Else : MiniWall編號_tb.Text = "MW00000000" : End If conn.Close() Dim NUM1 As Integer NUM1 = Double.Parse(Strings.Right(MiniWall編號_tb.Text, 8)) + 1 If NUM1 < 10 Then : MiniWall編號_tb.Text = "MW" & "0000000" & NUM1 ElseIf NUM1 > 9 And NUM1 < 100 Then : MiniWall編號_tb.Text = "MW" & "000000" & NUM1 ElseIf NUM1 > 99 And NUM1 < 1000 Then : MiniWall編號_tb.Text = "MW" & "00000" & NUM1 ElseIf NUM1 > 999 And NUM1 < 10000 Then : MiniWall編號_tb.Text = "MW" & "0000" & NUM1 ElseIf NUM1 > 9999 And NUM1 < 100000 Then : MiniWall編號_tb.Text = "MW" & "000" & NUM1 ElseIf NUM1 > 99999 And NUM1 < 100000 Then : MiniWall編號_tb.Text = "MW" & "00" & NUM1 ElseIf NUM1 > 999999 And NUM1 < 1000000 Then : MiniWall編號_tb.Text = "MW" & "0" & NUM1 ElseIf NUM1 > 9999999 Then : MiniWall編號_tb.Text = "MW" & NUM1 + 1 End If SQL_新增MINI_WALL_控制表() conn.Close() MsgBox("MINI WALL主體準備完畢") : Set_清單1() End If End Sub Private Sub Button3_Click(sender As Object, e As EventArgs) Handles 全部選擇2_bt.Click For i As Integer = 0 To 資料完備的鞋樣素描圖清單_dgv.Rows.Count - 1 : 資料完備的鞋樣素描圖清單_dgv.Rows(i).Cells("選擇").Value = True : Next i End Sub Private Sub Button4_Click(sender As Object, e As EventArgs) Handles 全部取消2_bt.Click For i As Integer = 0 To 資料完備的鞋樣素描圖清單_dgv.Rows.Count - 1 : 資料完備的鞋樣素描圖清單_dgv.Rows(i).Cells("選擇").Value = False : Next i End Sub Private Sub Button11_Click(sender As Object, e As EventArgs) Handles 全部選擇_bt.Click For i As Integer = 0 To 楦頭清單_dgv.Rows.Count - 1 : 楦頭清單_dgv.Rows(i).Cells("選擇").Value = True : Next i End Sub Private Sub Button10_Click(sender As Object, e As EventArgs) Handles 全部取消_bt.Click For i As Integer = 0 To 楦頭清單_dgv.Rows.Count - 1 : 楦頭清單_dgv.Rows(i).Cells("選擇").Value = False : Next i End Sub Private Sub Button13_Click(sender As Object, e As EventArgs) Handles 全部選擇1_bt.Click For i As Integer = 0 To 鞋樣素描圖清單_dgv.Rows.Count - 1 : 鞋樣素描圖清單_dgv.Rows(i).Cells("選擇").Value = True : Next i End Sub Private Sub Button12_Click(sender As Object, e As EventArgs) Handles 全部取消1_bt.Click For i As Integer = 0 To 鞋樣素描圖清單_dgv.Rows.Count - 1 : 鞋樣素描圖清單_dgv.Rows(i).Cells("選擇").Value = False : Next i End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles 新增楦頭_bt.Click If AASS = "" Then MsgBox("沒有選擇楦頭") Else Dim DDFF As Boolean For i As Integer = 0 To 資料完備的鞋樣素描圖清單_dgv.Rows.Count - 1 DDFF = 資料完備的鞋樣素描圖清單_dgv.Rows(i).Cells("選擇").Value = True If DDFF = True Then Exit For ElseIf i = 資料完備的鞋樣素描圖清單_dgv.Rows.Count - 1 And DDFF = False Then MsgBox("沒有選擇鞋樣素描") : Exit For End If Next i If DDFF = True Then SQL_查閱MW編號() If dr.Read() Then : Else SQL_新增MINI_WALL_明細表() conn.Close() End If conn.Close() For i As Integer = 0 To 資料完備的鞋樣素描圖清單_dgv.Rows.Count - 1 資料數 = 資料完備的鞋樣素描圖清單_dgv.Rows.Count : MyModule1.進度條() If 資料完備的鞋樣素描圖清單_dgv.Rows(i).Cells("選擇").Value = True Then PA7 = 資料完備的鞋樣素描圖清單_dgv.Rows(i).Cells("鞋樣素描圖編號").Value SQL_讀取MW編號() If dr.Read() Then : Else SQL_新增MINI_WALL_草圖明細() conn.Close() End If conn.Close() Else : End If Next i : WINPROFIT_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0 Set_清單2() : 清單3() : AASS = "" MsgBox("新增完成") End If End If End Sub Private Sub Button8_Click(sender As Object, e As EventArgs) Handles 楦頭存檔_bt.Click For i As Integer = 0 To 楦頭清單_dgv.Rows.Count - 1 資料數 = 楦頭清單_dgv.Rows.Count : MyModule1.進度條() PA8 = 楦頭清單_dgv.Rows(i).Cells("選擇").Value : PA9 = 楦頭清單_dgv.Rows(i).Cells("製造").Value PA10 = 楦頭清單_dgv.Rows(i).Cells("楦頭編號").Value SQL_修改MINI_WALL_明細表() conn.Close() Next i : WINPROFIT_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0 MsgBox("存檔完成") End Sub Private Sub Button9_Click(sender As Object, e As EventArgs) Handles 鞋樣素描存檔_bt.Click For i As Integer = 0 To 鞋樣素描圖清單_dgv.Rows.Count - 1 資料數 = 鞋樣素描圖清單_dgv.Rows.Count : MyModule1.進度條() PA8 = 鞋樣素描圖清單_dgv.Rows(i).Cells("選擇").Value : PA9 = 鞋樣素描圖清單_dgv.Rows(i).Cells("鞋樣素描圖編號").Value SQL_更改MINI_WALL_草圖明細() : conn.Close() Next i : WINPROFIT_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0 MsgBox("存檔完成") End Sub Private Sub Button14_Click(sender As Object, e As EventArgs) Handles 刪除選中Minwall主題_bt.Click Dim aa As MsgBoxResult aa = MsgBox("確定要刪除該筆資料?", MsgBoxStyle.OkCancel) If aa = MsgBoxResult.Ok Then SQL_刪除MINI_WALL_控制表() : conn.Close() SQL_MINI_WALL_明細表() : conn.Close() SQL_MINI_WALL_草圖明細() : conn.Close() MsgBox("刪除完成") : Set_清單1() : Set_清單2() : 清單3() End If End Sub Private Sub Button5_Click(sender As Object, e As EventArgs) Handles 刪除楦頭_bt.Click Dim aa As MsgBoxResult aa = MsgBox("確定要刪除該筆資料?", MsgBoxStyle.OkCancel) If aa = MsgBoxResult.Ok Then SQL_刪除MINI_WALL明細表() : conn.Close() SQL_刪除MINI_WALL_楦頭() : conn.Close() MsgBox("刪除完成") : Set_清單2() : 清單3() End If End Sub Private Sub Button6_Click(sender As Object, e As EventArgs) Handles 刪除素描資料_bt.Click Dim aa As MsgBoxResult aa = MsgBox("確定要刪除該筆資料?", MsgBoxStyle.OkCancel) If aa = MsgBoxResult.Ok Then SQL_刪除素描資料() : conn.Close() MsgBox("刪除完成") : Set_清單2() : 清單3() End If End Sub Private Sub Button7_Click(sender As Object, e As EventArgs) Handles 列印_bt.Click 楦頭最大數 = 0 : 草圖最大數 = 0 For i As Integer = 0 To 楦頭清單_dgv.Rows.Count - 1 If 楦頭清單_dgv.Rows(i).Cells("選擇").Value = True Then 楦頭最大數 += 1 Set_DGV4載入前設定() PA12 = 楦頭清單_dgv.Rows(i).Cells("楦頭編號").Value SQL_列印清單() Set_DGV4載入後設定() : Set_grid3() 草圖計算數 = 0 For ii As Integer = 0 To 鞋樣素描圖清單_dgv.Rows.Count - 1 If 鞋樣素描圖清單_dgv.Rows(ii).Cells("選擇").Value = True Then 草圖計算數 += 1 End If Next ii If 草圖計算數 > 草圖最大數 Then 草圖最大數 = 草圖計算數 End If End If Next i xlApp = CType(CreateObject("Excel.Application"), Application) xlBook = xlApp.Workbooks.Add xlApp.DisplayAlerts = True xlBook.Activate() xlSheet = NewMethod(xlBook) xlSheet.Activate() xlApp.Visible = True xlApp.Application.WindowState = xlMaximized xlSheet.Cells(1, 1) = 品牌_cb.Text & " - " & 季節_cb.Text & " - MINI WALL" : AA(xlApp, xlSheet) : N1 = 0 For I As Integer = 0 To 草圖最大數 - 1 xlSheet.Cells(10 + N1, 1) = "Sketch" : xlSheet.Cells(11 + N1, 1) = "STYLE #" : xlSheet.Cells(12 + N1, 1) = "STYLE NAME" xlSheet.Cells(13 + N1, 1) = "LAST #" : xlSheet.Cells(14 + N1, 1) = "OUTSOLE #" BB(xlApp, xlSheet) : JJ(xlApp, xlSheet) N1 += 5 Next N2 = 0 For i As Integer = 0 To 楦頭清單_dgv.Rows.Count - 1 If 楦頭清單_dgv.Rows(i).Cells("選擇").Value = True Then DD(xlApp, xlSheet) AASS = 楦頭清單_dgv.Rows(i).Cells("楦頭編號").Value : 圖片導入1() If 列印_cb.Checked = True Then xlSheet.Cells(3, 2 + N2) = 楦頭清單_dgv.Rows(i).Cells("製造").Value End If xlSheet.Cells(8, 2 + N2) = 楦頭清單_dgv.Rows(i).Cells("楦頭名").Value FF(xlApp, xlSheet) For ii As Integer = 0 To 999999999 If PictureBox1.Image Is Nothing Then Else CC(xlApp, xlSheet) ii = 999999999 End If Next Set_DGV4載入前設定() PA13 = 楦頭清單_dgv.Rows(i).Cells("楦頭編號").Value SQL_列印清單1() Set_DGV4載入後設定() : Set_grid3() N1 = 0 For ii As Integer = 0 To 鞋樣素描圖清單_dgv.Rows.Count - 1 If 鞋樣素描圖清單_dgv.Rows(ii).Cells("選擇").Value = True Then SSDD = 鞋樣素描圖清單_dgv.Rows(ii).Cells("鞋樣素描圖編號").Value 圖片導入2() xlSheet.Cells(11 + N1, 2 + N2) = 鞋樣素描圖清單_dgv.Rows(ii).Cells("型體編號").Value : xlSheet.Cells(12 + N1, 2 + N2) = 鞋樣素描圖清單_dgv.Rows(ii).Cells("型體名稱").Value xlSheet.Cells(13 + N1, 2 + N2) = 鞋樣素描圖清單_dgv.Rows(ii).Cells("楦頭編號").Value : xlSheet.Cells(14 + N1, 2 + N2) = 鞋樣素描圖清單_dgv.Rows(ii).Cells("模具編號").Value GG(xlApp, xlSheet) For iii As Integer = 0 To 999999999 If PictureBox2.Image Is Nothing Then Else EE(xlApp, xlSheet) iii = 999999999 End If Next N1 += 5 End If Next N2 += 2 End If Next HH(xlApp, xlSheet) xlSheet.PageSetup.PrintArea = "" xlApp.Cells.Select() xlSheet.Range("B1").Select() xlApp.Application.WindowState = xlMinimized MsgBox("列印完成") PictureBox1.Image = Nothing : PictureBox2.Image = Nothing : 楦頭清單_dgv.DataSource = Nothing : ds1.Clear() : 鞋樣素描圖清單_dgv.DataSource = Nothing : ds3.Clear() End Sub Private Shared Function NewMethod(xlBook As Workbook) As Worksheet Return CType(xlBook.Worksheets.Add, Worksheet) End Function Private Sub RTFGRTFG() If N2 = 0 Then : 位置1 = "B6" : 位置3 = "C" ElseIf N2 = 2 Then : 位置1 = "D6" : 位置3 = "E" : ElseIf N2 = 4 Then : 位置1 = "F6" : 位置3 = "G" : ElseIf N2 = 6 Then : 位置1 = "H6" : 位置3 = "I" ElseIf N2 = 8 Then : 位置1 = "J6" : 位置3 = "K" : ElseIf N2 = 10 Then : 位置1 = "L6" : 位置3 = "M" : ElseIf N2 = 12 Then : 位置1 = "N6" : 位置3 = "O" ElseIf N2 = 14 Then : 位置1 = "P6" : 位置3 = "Q" : ElseIf N2 = 16 Then : 位置1 = "R6" : 位置3 = "S" : ElseIf N2 = 18 Then : 位置1 = "T6" : 位置3 = "U" ElseIf N2 = 20 Then : 位置1 = "V6" : 位置3 = "W" : ElseIf N2 = 22 Then : 位置1 = "X6" : 位置3 = "Y" : ElseIf N2 = 24 Then : 位置1 = "Z6" : 位置3 = "AA" ElseIf N2 = 26 Then : 位置1 = "AB6" : 位置3 = "AC" : ElseIf N2 = 28 Then : 位置1 = "AD6" : 位置3 = "AE" : ElseIf N2 = 30 Then : 位置1 = "AF6" : 位置3 = "AG" ElseIf N2 = 32 Then : 位置1 = "AH6" : 位置3 = "AI" : ElseIf N2 = 34 Then : 位置1 = "AJ6" : 位置3 = "AK" : ElseIf N2 = 36 Then : 位置1 = "AL6" : 位置3 = "AM" ElseIf N2 = 38 Then : 位置1 = "AN6" : 位置3 = "AO" : ElseIf N2 = 40 Then : 位置1 = "AP6" : 位置3 = "AQ" : ElseIf N2 = 42 Then : 位置1 = "AR6" : 位置3 = "AS" ElseIf N2 = 44 Then : 位置1 = "AT6" : 位置3 = "AU" : ElseIf N2 = 46 Then : 位置1 = "AV6" : 位置3 = "AW" : ElseIf N2 = 48 Then : 位置1 = "AX6" : 位置3 = "AY" ElseIf N2 = 50 Then : 位置1 = "AZ6" : 位置3 = "BA" : ElseIf N2 = 52 Then : 位置1 = "BB6" : 位置3 = "BC" : ElseIf N2 = 54 Then : 位置1 = "BD6" : 位置3 = "BE" ElseIf N2 = 56 Then : 位置1 = "BF6" : 位置3 = "BG" : ElseIf N2 = 58 Then : 位置1 = "BH6" : 位置3 = "BI" : ElseIf N2 = 60 Then : 位置1 = "BJ6" : 位置3 = "BK" ElseIf N2 = 62 Then : 位置1 = "BL6" : 位置3 = "BM" : ElseIf N2 = 64 Then : 位置1 = "BN6" : 位置3 = "BO" : ElseIf N2 = 66 Then : 位置1 = "BP6" : 位置3 = "BQ" ElseIf N2 = 68 Then : 位置1 = "BR6" : 位置3 = "BS" : ElseIf N2 = 70 Then : 位置1 = "BT6" : 位置3 = "BU" : ElseIf N2 = 72 Then : 位置1 = "BV6" : 位置3 = "BW" ElseIf N2 = 74 Then : 位置1 = "BX6" : 位置3 = "BY" : ElseIf N2 = 76 Then : 位置1 = "BZ6" : 位置3 = "CA" : ElseIf N2 = 78 Then : 位置1 = "CB6" : 位置3 = "CC" ElseIf N2 = 80 Then : 位置1 = "DD6" : 位置3 = "CE" : End If If N2 > 24 Then 位置2 = Strings.Left(位置1, 2) & ":" & Strings.Left(位置1, 2) : 位置3 = Strings.Left(位置3, 2) & ":" & Strings.Left(位置3, 2) : 位置4 = Strings.Left(位置1, 2) & 10 + N1 位置5 = Strings.Left(位置1, 2) & "6:" & Strings.Left(位置1, 2) & "9" : 位置6 = Strings.Left(位置1, 2) & 10 + N1 & ":" & Strings.Left(位置1, 2) & 14 + N1 位置7 = "A1:" & Strings.Left(位置3, 2) & 1 : 位置8 = "B3:" & Strings.Left(位置1, 2) & 3 : 位置9 = "A6:" & Strings.Left(位置3, 2) & 5 * 草圖最大數 + 9 ElseIf N2 = 24 Then 位置2 = Strings.Left(位置1, 1) & ":" & Strings.Left(位置1, 1) : 位置3 = Strings.Left(位置3, 2) & ":" & Strings.Left(位置3, 2) : 位置4 = Strings.Left(位置1, 1) & 10 + N1 位置5 = Strings.Left(位置1, 1) & "6:" & Strings.Left(位置1, 1) & "9" : 位置6 = Strings.Left(位置1, 1) & 10 + N1 & ":" & Strings.Left(位置1, 1) & 14 + N1 位置7 = "A1:" & Strings.Left(位置3, 2) & 1 : 位置8 = "B3:" & Strings.Left(位置1, 1) & 3 : 位置9 = "A6:" & Strings.Left(位置3, 2) & 5 * 草圖最大數 + 9 ElseIf N2 < 24 Then 位置2 = Strings.Left(位置1, 1) & ":" & Strings.Left(位置1, 1) : 位置3 = Strings.Left(位置3, 1) & ":" & Strings.Left(位置3, 1) : 位置4 = Strings.Left(位置1, 1) & 10 + N1 位置5 = Strings.Left(位置1, 1) & "6:" & Strings.Left(位置1, 1) & "9" : 位置6 = Strings.Left(位置1, 1) & 10 + N1 & ":" & Strings.Left(位置1, 1) & 14 + N1 位置7 = "A1:" & Strings.Left(位置3, 1) & 1 : 位置8 = "B3:" & Strings.Left(位置1, 1) & 3 : 位置9 = "A6:" & Strings.Left(位置3, 1) & 5 * 草圖最大數 + 9 End If End Sub Private Sub AA(ByVal myExcel As Application, ByVal xlSheet As Worksheet) xlSheet.Cells.Select() With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 15 xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 25 : xlSheet.Rows("2:2").Select : myExcel.Selection.RowHeight = 5 xlSheet.Rows("3:3").Select : myExcel.Selection.RowHeight = 25 : xlSheet.Rows("4:5").Select : myExcel.Selection.RowHeight = 5 xlSheet.Rows("6:6").Select : myExcel.Selection.RowHeight = 90 : xlSheet.Rows("7:7").Select : myExcel.Selection.RowHeight = 5 xlSheet.Rows("9:9").Select : myExcel.Selection.RowHeight = 5 End Sub Private Sub BB(ByVal myExcel As Application, ByVal xlSheet As Worksheet) xlSheet.Rows(10 + N1 & ":" & 10 + N1).Select : myExcel.Selection.RowHeight = 90 End Sub Private Sub CC(ByVal myExcel As Application, ByVal xlSheet As Worksheet) RTFGRTFG() Clipboard.SetDataObject(PictureBox1.Image) Thread.Sleep(100) '延迟0.1秒 xlSheet.Range(位置1).Select() myExcel.ActiveSheet.Paste If PictureBox1.Image.Height < PictureBox1.Image.Width Then myExcel.Selection.ShapeRange.Width = 90 Else myExcel.Selection.ShapeRange.Height = 85 End If myExcel.Selection.ShapeRange.IncrementLeft(2) myExcel.Selection.ShapeRange.IncrementTop(2) End Sub Private Sub DD(ByVal myExcel As Application, ByVal xlSheet As Worksheet) RTFGRTFG() xlSheet.Columns(位置2).Select : myExcel.Selection.ColumnWidth = 15 xlSheet.Columns(位置3).Select : myExcel.Selection.ColumnWidth = 1 End Sub Private Sub EE(ByVal myExcel As Application, ByVal xlSheet As Worksheet) RTFGRTFG() Clipboard.SetDataObject(PictureBox2.Image) xlSheet.Cells(1, 1).Select Thread.Sleep(100) '延迟0.1秒 xlSheet.Range(位置4).Select() myExcel.ActiveSheet.Paste If PictureBox2.Image.Height < PictureBox2.Image.Width Then myExcel.Selection.ShapeRange.Width = 90 Else myExcel.Selection.ShapeRange.Height = 85 End If myExcel.Selection.ShapeRange.IncrementLeft(2) myExcel.Selection.ShapeRange.IncrementTop(2) End Sub Private Sub FF(ByVal myExcel As Application, ByVal xlSheet As Worksheet) RTFGRTFG() xlSheet.Range(位置5).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 With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With End Sub Private Sub GG(ByVal myExcel As Application, ByVal xlSheet As Worksheet) RTFGRTFG() xlSheet.Range(位置6).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 With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With End Sub Private Sub HH(ByVal myExcel As Application, ByVal xlSheet As Worksheet) N2 = 楦頭最大數 * 2 - 2 RTFGRTFG() xlSheet.Cells.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(位置7).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 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(位置8).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(位置9).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.ActiveWindow.DisplayGridlines = False End Sub Private Sub JJ(ByVal myExcel As Application, ByVal xlSheet As Worksheet) 位置10 = "A" & 10 + N1 & ":A" & 14 + N1 xlSheet.Range(位置10).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 With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With End Sub End Class